lundi 15 juin 2015

In Ember 1.13 and later what key should I use with each when iterating over an array of strings?

In Ember 1.13 the following code generates a warning:

{{#each widgetNames as |widgetName|}}
  {{component widgetName removeWidget="removeWidget"}}
{{/each}}

Where widgetNames is an array of strings in a parent controller.

widgetNames: []

In Ember 1.13 I now get this warning:

WARNING: Using {{each}} without specifying a key can lead to unusual behavior. Please specify a key that identifies a unique value on each item being iterated. E.g. {{each model key="@guid" as |item|}}.

This would be easy enough to fix in you typical model scenario, but how do I specify a key for an array of strings?




Aucun commentaire:

Enregistrer un commentaire