EmberJS – Customizing a Component’s Element

  • Post author:
  • Post category:EmberJS
  • Post comments:1 Comment
Customize element

Customize the element by using Ember.Component subclass and set the tagName property to it.

Syntax

import Ember from 'ember';

export default Ember.Component.extend ({
   tagName: 'tag_name'
});

Example

The example given below specifies customizing a component’s element by using tagName property. Create a component with the name post-action, which will get defined under app/components/.

Open the post-action.js file and add the following code −

import Ember from 'ember';

export default Ember.Component.extend ({
   tagName: 'h1'
});

Now open the component template file post-action.hbs with the following line of code −

Welcome to Adglob...
{{yield}}

Open the index.hbs file and add the following line of code −

{{post-action}}
{{outlet}}

Previous Page:-Click Here

This Post Has One Comment

Leave a Reply