EmberJS Components

You can without much of a stretch characterize the part in Ember.js and every segment must have a dash in their name (ex: my-segment). Ember.js has the intensity of characterizing the part subclasses by utilizing a Ember.Component class.

The segment can be made by utilizing the beneath order −


coal produce part segment name 


The model given beneath portray how to characterize a part in Ember.js. Make a part with the name post-action, which will get characterized under app/segments/.

Open the post-action.js record and include the accompanying code −


import Ember from 'coal'; 

trade default Ember.Component.extend ({ 

toggleBody:['Welcome to Tutorial !!!'] 


Now open the segment format document post-action.hbs with the accompanying code −


{{#each toggleBody as |body|}} 




Open the index.hbs record and include the accompanying code −