I am trying to read the following in the root component of an angular app
<app-root [something]="'sometingvalue'">Loading...</app-root>
I have the angular component the following way
export class AppComponent {
something: string = 'abcd';
title: string = 'app works!';
elm: ElementRef;
constructor(elm: ElementRef) {
this.elm = elm;
}
ngOnInit() {
this.something = this.elm.nativeElement.getAttribute('something');
}
}
However I always get null on the ngOnInit even, how do I read this value. I cannot use @input since this is the root component.