父组件类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别提了:) –