在选择器Angular 2中加载表格

时间:2018-09-25 20:49:09

标签: html angular

如何在Angular 2中加载表选择器?

table.html

<table [mfData]="(data | filter:name)" #mf="mfDataTable" >
   <thread>
      <tr>
        <th> row 1 </th>
      </tr>
   </thread>
   <app-view> Loading... </app-view>
</table>

ComponentA.component.ts

@Component({
  selector: 'app-dataSet',
  templateURL: './table.html'
})

...
// this line is the table value (this.data is the mapping for mf)
this.getNameService.getName().subscribe( res => { this.data = res; });
...

body.html

<tbody>
   <tr *ngFor="let item of mf?.data">
        <td> {{item.name}} </td>
   </tr>
</tbody>

ComponentB.component.ts

@Component({
  selector: 'app-view',
  templateURL: './body.html'
})

export class ComponentB {
// what do I need here in order to get mf data to load?

}

我想要使应用程序视图正常工作,但无法将数据从组件A传递到组件B

0 个答案:

没有答案