Geordnete KomponenteAngular2 - detect Komponente Kind variable Änderung
import { Component, OnChange } from '@angular/core';
import { ChildComponent } from '../../reusable/user-offers/user-offers.component';
@Component({
...
directives: [ ChildComponent ]
})
export class ParentComponent implements OnChange {
@ViewChild(ChildComponent)
private child: ChildComponent;
ngOnChanges() {
detecting this.child.detectme variable...
}
}
Kinderkomponente
import { Component, Input } from '@angular/core';
@Component({
...
})
export class ParentComponent {
@Input() detectme: string;
//in view something changes detectme value (not important here)
}
Wie kann ich erkennen, ob child.detectme geändert und drucken Sie es Wert ist?
Es ist 'ngOnChanges' nicht' ngOnChange' – Lekhnath
Sorry, aber das wurde durch manuelles Umschreiben verursacht. Ich habe ngOnChanges. – elzoy