【发布时间】:2017-09-08 10:42:10
【问题描述】:
父组件类
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() 将无法显示子组件。
为什么?
【问题讨论】:
标签: angular typescript