在angular2中绑定子组件中的根组件

时间:2018-03-29 09:59:54

标签: angular web

我需要在子组件中绑定根组件,当单击适当的链接时,会出现一个弹出窗口并显示根组件数据enter image description here

在activity.html页面中添加并调用相关函数 但数据没有加载

<section id="ProjectContent" *ngIf="isShowPlan">
    <!--<project-app  [sectionType]="FLOWCHART" [pageType]="projectPageType"
    [section]="projectSection" [projectId]="newprojectId"  
    [clientId]="newclientId" [projectName]="projectName">
    Loading...</project-app>-->

    <project-app section_type="LINK" page_type="projectPageType"section="projectSection"
     project_id="newprojectId"client_id="newclientId" is_expand="true">
     Loading...</project-app>

     <!--<project-app sectionType="LINK" pageType="projectPageType" 
      section="projectSection" projectId="newprojectId" clientId="newclientId" 
      projectName="projectName">
     Loading...</project-app>-->

 </section>

1 个答案:

答案 0 :(得分:0)

通过DI机制,您可以将任何父组件注入子

<强> Child.component.ts

...
constuctor(public parent: SomeParentComponent){

}