WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

EmberJS Displaying a List of Items


You can show the rundown of things in an exhibit by utilizing the #each partner and it emphasizes once for every thing present in an array.

Syntax

 

<ul> 

{{#each array_name as |block-param| }} 

<li>{{block-param}}</li> 

{{/each}} 

</ul> 

In the above code, format emphasizes array_name, which incorporates objects and every thing in the exhibit determined as block-param.

Example

The model given beneath showcases a rundown of things by utilizing the #each aide. To show the things, make a part by utilizing the accompanying order −

 

coal g segment gather list 

Next, open the gathering list.js made under application/part/alongside the accompanying code −

 

import Ember from 'coal'; 

trade default Ember.Component.extend ({ 

arrayOFgroup:['apple','pineapple','banana'] 

}); 

Create a format called group-list.hbs under app/layouts/ with the accompanying code −

 

<ul> 

{{#each arrayOFgroup as |fruit|}} 

<li>{{fruit}}</li> 

{{/each}} 

</ul> 

To list the things from an exhibit, utilize the beneath code in the application.hbs record made under app/formats/

 

<p>List of Items:</p> 

{{group-list}} 

{{outlet}}