Как получить доступ к переменной из другого компонента в угловой
Go to your app.module.ts and make the provider of that component
you want to inherit with other classes:
Ex: providers: [DatePipe, AccountComponent]
Then go to the class you want access of that variable,
and import the component into that:
Ex: import { AccountComponent } from '../account/account.component';
Make the constructor of it:
Ex:
constructor(private accountComponent: AccountComponent){}
And happily get access to the variables:
Ex: this.url = this.accountComponent.apiEndPoint+'hello';
Jonathan Gomez