Anna
Anna

Reputation: 1689

Angular let-col let-item="rowData"

I recently started to work on Angular 4 and while working on primeNG data table I came across a syntax like this let-col let-item="rowData". I am confused what it is doing in my code and and why do I need 2 let-*'s. Can anyone please spare sometime and explain me the same?

<p-dataTable [value]="employees" selectionMode="single" [(selection)]="selectedEmployee" (onRowSelect)="onRowSelect($event)" [paginator]="true" [rows]="10" [responsive]="true">
    <header>Employee Management Service</header>
    <p-column field="name" header="name" [sortable]="true">
     <ng-template let-col let-item="rowData">
       <label>some data</label>
     </ng-template>
    </p-column>
</p-dataTable>

I did got through What is let-* in Angular 2 templates? but this did not cleared my doubts. And what will happen if I do {{col}} and {{item}}. Please guide.

Upvotes: 4

Views: 9679

Answers (1)

user4676340
user4676340

Reputation:

let-item="rowData" in HTML is the equivalent of let item = rowData in Typescript

It's used in Angular templates <ng-template>.

let-col use the implicit declaration, which would be let col = col.

The variables rowData and col are declared by the primeNG module.

Upvotes: 5

Related Questions