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?
}