What is let-* in Angular 2 templates?

I came across a strange assignment syntax inside an Angular 2 template. <template let-col let-car=”rowData” pTemplate=”body”> <span [style.color]=”car[col.field]”>{{car[col.field]}}</span> </template> It appears that let-col and let-car=”rowData” create two new variables col and car that can then be bound to inside the template. Source: https://www.primefaces.org/primeng/#/datatable/templating What is this magical let-* syntax called? How does it work? What … Read more

Can’t bind to ‘ngForOf’ since it isn’t a known property of ‘tr’ (final release)

I’m using Angular2 2.1.0. When I want to display a list of companies, I got this error. in file.component.ts : public companies: any[] = [ { “id”: 0, “name”: “Available” }, { “id”: 1, “name”: “Ready” }, { “id”: 2, “name”: “Started” } ]; In file.component.html : <tbody> <tr *ngFor=”let item of companies; let i … Read more

How to add “class” to host element?

I dont’t know how to add to my component <component></component> a dynamic class attribute but inside the template html (component.html). The only solution I found is to modify the item via “ElementRef” native element. That solution seems a little complicated to do something that should be very simple. Another problem is that CSS has to … Read more

How can I write data attributes using Angular?

I feel like I am missing something. When I try to use a data attribute in my template, like this: <ol class=”viewer-nav”> <li *ngFor=”#section of sections” data-sectionvalue=”{{ section.value }}”> {{ section.text }} </li> </ol> Angular 2 crashes with: EXCEPTION: Template parse errors: Can’t bind to ‘sectionvalue’ since it isn’t a known native property (“ ]data-sectionvalue=”{{ … Read more