I have a component A
, which has custom directive on the page:
View:
<warning [details]='details'></warning>
Component:
export class AComponent implements OnInit {
details: ConfirmDetails = {
header_class: ""
};
languageChanged(newLang: string) {
this.currentLanguage = newLang;
this.ngOnInit();
}
ngOnInit() {
if (this.currentLanguage === "English"){
this.details.header_class = "line1 font50";
}
else{
this.details.header_class = "line2 font90";
}
}
Once languageChanged()
called, the directive is not updating.
export class WarningComponent implements OnInit {
@Input() details: ConfirmDetails;
ngOnInit() {
console.log(this.details.header_class);
}
}
So at the first page loading the details
input is "line1 font50", but when
languageChanged()
called it does not change, so I dont see any console output.
I would appreciate any help.