2
我有两个组件,子组件显示状态由父级控制。如何让孩子知道它的父母是否改变了隐藏的属性?如何让组件检测其在angular2中的隐藏状态?
// Parnet
@Component(selector: '[component-parent]',
templateUrl: 'component-parent.html')
class ComponentParent {
bool enableChild;
}
<div>
<div component-child [hidden]="enableChild"></div>
</div>
// Child
@Component(selector: '[component-child]',
templateUrl: 'component-child.html')
class ComponentChild {
// How child aware not it is not hidden anymore?
}