我想通过点击路由器插座内组件模板中的按钮来触发路由器插座外部组件模板中div的隐藏/显示:
app组件
`<div class="content col-md-10 container-fluid">
<company-add-form></company-add-form>
<router-outlet></router-outlet>
</div>`
公司添加表单组件
`<div>
<p>Make me showwwww</p>
<button class="btn">Close</button>
</div>`
公司页面组件(将在路由器插座内部呈现)
`<div>
<button class="btn">Open company add form</button>
</div>`
思想
答案 0 :(得分:0)
您无法绑定路由器添加的组件。
您应该使用共享服务@angular/injectable查看component communication来获取@angular cookbook中的示例。