EmberJS – Components

components

The Ember.js components uses the W3C web component specification and provides true encapsulation UI widgets. It contains the three main specification as templatesshadow DOM and custom elements. The component is declared within the data-template-name which has a path name instead of a plain string and are prefixed with “components/”.

The following table lists down the action events of actions −

S.No.Action Events & Description
1Defining a Component
You can easily define a component in Ember.js and each component must have a dash in their name.
2Component Lifecycle
Component lifecycle uses some of the methods in order to execute the code at specific times in a component’s life.
3Passing Properties to a Component
The component doesn’t access the property directly in the template scope. Therefore, just declare the property at the time of component deceleration.
4Wrapping Content in a Component
You can wrap the content in a component by using the templates.
5Customizing a Component’s Element
You can customize the component’s element such as attributes, class names by using a subclass of Ember.Component in the JavaScript.
6Using Block Params
The passed properties in a component can give back the result in a block expression.
7Handling Events
The user events such as double-click, hovering, key press etc can be handled by event handlers. To do this, apply the event name as a method on the component.
8Triggering Changes with Actions
Components can trigger the changes and communicate with events by using the actions.

Next Topic:-Click Here

Leave a Reply