I have a component with input param as name
<lib-name [name]="name" > </lib-name>
These are called at multiple places in the project.
Now name is a app-constants which is assigned in app-component.
Currently i have to import name in every component ts file to pass it to library component.
Can we globally define this name for the child-component. So that my code will be clean
<lib-name > </lib-name>
Note:- Name can change on the basis of signed in user Also it is a library component, i cannot just directly get the name in the library component.
@Directive({
selector: '[appTest]'
})
export class TestDirective {
constructor(private lib: LibComponent) {
this.lib.name = "Some Name";
}
}
And use this directive
<lib-name appTest> </lib-name>