This is a project built in Angular 6. I've got two classes, one and two. I want to use a variable in both classes. I've imported the class, but I'm not sure how to access the variable.
How do I use use "num:number = 2018" from one.component in two.component?
one.component.ts:
import { Component, OnInit } from '@angular/core';
@Component({
  selector: 'app-one',
  templateUrl: './one.component.html',
  styleUrls: ['./one.component.css']
})
export class OneComponent implements OnInit {
  num:number = 2018;
  constructor() { }
  ngOnInit() { }
  getNum() : number{
    return this.num;
  }
}
two.component.ts:
import { Component, OnInit } from '@angular/core';
import { OneComponent } from '../one/one.component';
@Component({
  selector: 'app-two',
  templateUrl: './two.component.html',
  styleUrls: ['./two.component.css']
})
export class TwoComponent implements OnInit {
  constructor() { }
  ngOnInit() {  }
}
 
    