Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4828

Passing property from action to index.hbs template

$
0
0

@Stijn_Aerts wrote:

I have this code in my index.hbs file:

<button {{action 'showHotspots'}} class="btn btn-success padding">{{hotspotCategory.name}}</button>

I have the showHotspots method in my routes/index.js file:

showHotspots: function( selection ) {
  this.toggleProperty( 'idFromButton' );
}

The method should toggle this part in my routes/index.js:

{{#if idFromButton}}
  <p>Test1</p>
{{/if}}

However this is not working, when I do it as a component it works but I need the Test1 on a specific place on my page (below all the generated buttons). When I do it in components the Test1 gets displayed between the buttons.

Instead of working with a component I want to do this in my index.js file so I can control the structure of the page.

In short: on my index.hbs i have a if-statement that checks if a variable is true. I want to set this variable from my routes/index.js file (or from somewhere else, doesn't matter really) using a method that is called in either the same index.hbs file or from a component-1.hbs file.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles