Reputation: 2169
I want to know how to break
or continue
{{#each}} loop
in emberjs handlebars.
<ul>
{{#each people}}
//if name == 'xyz' i want to break the loop
// else list the name
<li>{{name}}</li>
{{/each}}
</ul>
I know how to use conditions, like below
{{#if (eq name "xyz")}}
bye
{{else}}
{{name}}
{{/if}}
Upvotes: 3
Views: 2744
Reputation: 12872
There is no break
or continue
in emberjs handlebars for each
block. so I would encourage you to modify the people
array through computed property.
peopleLimited:Ember.comptued('people.[]',function(){
let result = [];
//implement your logic here to cut down people array.
return result;
});
Upvotes: 3