In angular, I have one var of type number in the file first.ts, how can I pass this value in the file second.ts?
CodePudding user response:
first.ts
export var myNumber: number =3;
second.ts
import { myNumber } from './first.ts'
var myIncrementNumber = myNumber 1;
CodePudding user response:
Export it.
Assuming both are in the same directory:
first.ts
export const x = 1
second.ts
import { x } from './first';