父組件類angular2變化的子組件然後更改父組件,此值不工作
export class Parent {
show: boolean = false;
constructor() { }
showChild() {
this.show = true;
}
}
父組件模板
<child [isShow]="show"></child>
子組件類
export class Child {
@Input isShow: boolean = false;
constructor() { }
onClick() {
this.isShow = false;
}
}
在我觸發子組件中的onClick()後,showChild()將無法顯示子組件。
爲什麼?
謝謝。你的回答比較好。 – NieWei
@NieWei別提了:) –