【发布时间】:2017-06-12 03:35:41
【问题描述】:
我有两个主要组件,一个是main-well(它有一个用于显示不同组件的路由器链接),第二个是右侧组件pop-out,需要在每个页面上都可用应用程序。我希望从路由组件(main-well 的后代)中控制此pop-out 的隐藏和显示操作。
父页面:
<page-area style="display: inline-block">
<main-well></main-well>
<pop-out></pop-out>
</page-area>
MainWell.component.html:
<div class="fill-whole-page">
<router-link></router-link>
</div>
PopOut.component.html:
<div *ngIf="show" class="pop-out-action pop-out-style">
<button>Add</button>
<button>Remove</button>
<button>Copy</button>
</div>
在<router-link> 中打开的组件需要能够告诉pop-out 何时显示和隐藏。
您如何操作父或祖父的兄弟组件的控件(或访问组件功能)?
【问题讨论】:
标签: angular data-binding components siblings