Vote count: 0
I have a strange problem I am not able to solve for several hours.
In my component I have:
@Input() content : string;
private contentPreview : any;
ngOnChanges(changes: SimpleChanges) {
this.contentPreview = changes['content'].currentValue;
console.log(changes['content'].currentValue); // <-- WORKS
}
The variable this.contentPreview is not changed. If I try displaying it, it remains undefined. Even if I try this.contentPreview = "X"; it keeps undefined everywhere else in the component.
Am I missing something, or is it a bug?
asked 25 secs ago
Angular2 private variable not updated in ngOnChanges()
Aucun commentaire:
Enregistrer un commentaire