EmberJS Displaying Keys in an Object

You can show the keys in the article by utilizing the #each-in partner and it repeats once for each key go in object.




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




In the above code, format repeats array_name, which incorporates objects and each key in the article determined as block-param.


The precedent given beneath showcases the keys in the item by utilizing the #each-in aide. To show the things, make a part by utilizing the accompanying order −


ash g segment store-classifications 

Now open the store-categories.js made under app/part/ alongside the accompanying code −


import Ember from 'ash'; 

send out default Ember.Component.extend ({ 

willRender() { 

this.set('typesOfvehicles', { 

'Vehicles': ['Ferrari', 'Audi', 'BMW'], 

'Engine bicycles': ['Harley-Davidson', 'Yamaha','Honda'] 




Create a layout called store-categories.hbs under app/formats/ with the accompanying code −



{{#each-in typesOfvehicles as |category products|}} 



{{#each items as |product|}} 







To list the keys in the item, utilize the accompanying code in the application.hbs record made under app/formats/


<p>This is Displaying the Keys in an Object:</p>