Transfer area data to ng content in Angular2

I am looking for a solution to pass the current data of a component area to the ng-content directive.

I have an app-table component template with data that I want to pass to 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 the page template where I want to use this data:

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

Is it possible?

+6
source share
1 answer

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

The ng content component is poorly documented, unfortunately. In the near future, according to the Angular GitHub issue ( https://github.com/angular/angular.io/issues/3099 ).

+4
source

Source: https://habr.com/ru/post/1013835/


All Articles