Angular 2 ng para el primer, último, bucle de índice
Estoy tratando de establecer como predeterminado la primera aparición en este ejemplo: plunkr
Obteniendo el siguiente error:
Unhandled Promise rejection: Template parse errors:
TypeError: Cannot read property 'toUpperCase' of undefined ("dButtonToggleGroup">
<md-button-toggle [ERROR ->]*ngFor="let indicador of indicadores; #first = first" value="indicador.id" [checked]="first">
"): ng:///AppModule/HomeComponent.html@35:78
Parser Error: Unexpected token #, expected identifier, keyword, or string at column 31 in [let indicador of indicadores; #first = first] in ng:///AppModule/HomeComponent.html@35:78 (" <md-button-toggle *ngFor="let indicador of indicadores; #first = first" value="indicador.id" [ERROR ->][checked]="first">
<span>{{ indicado"): ng:///AppModule/HomeComponent.html@35:153
¿Qué está mal??
25
Author: Jeffrey Roosendaal, 2017-05-31
1 answers
Mira esto plunkr.
Cuando estás enlazando a variables, necesitas usar los corchetes. Además, utilizas el hashtag cuando quieres obtener referencias a elementos en tu html, no para declarar variables dentro de plantillas como esa.
<md-button-toggle *ngFor="let indicador of indicadores; let first = first;" [value]="indicador.id" [checked]="first">
...
Editar: Gracias a Christopher Moore : Angular expone las siguientes variables locales:
index
first
last
-
even
odd
56
Author: Steveadoo,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-17 13:31:19
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-17 13:31:19