Pass scope data into ng

I'm looking for solution to pass current component scope data into ng-content directive.

I've app-table component template with data I want to pass into child content, using some solution like this:

<!-- some html before -->
<table>
    <!-- complex header markup with sorting/filtering support -->

    <tr *ngFor="let item of data">
         <ng-content [value]="item"></ng-content> //how to pass data?
    </tr>
</table>
//some html after

And page template where I want to use this data:

<app-table>
     <td>{{value.Name}}</td>
     ...
</app-table>

Is this possible?


I think you could find your answer here: Angular 2 passing html to ng-content with bindings.

The ng-content component is badly documented, unfortunately. It will be soon, according to the Angular GitHub issue (https://github.com/angular/angular.io/issues/3099).

链接地址: http://www.djcxy.com/p/94702.html

上一篇: .NET Core 1.0应用程序不能在.NET Core 1.1系统上运行

下一篇: 将范围数据传递给ng