mardi 10 mai 2016

How can I add a class to a div from a component in emberjs?

I have the main-navbar component.

The app/templates/components/main-navbar.hbs file looks like this:

<ul>
    <li>Home</li>
    <li>Blog</li>
</ul>
<button> Add class </button>

When I click on the button I want the ul element to recieve a test class <ul class='test'> and when I click again the button, the test class to be removed.

How can I achieve this action for the button? I assume that the app/components/main-navbar.js file must be used.




Aucun commentaire:

Enregistrer un commentaire