vendredi 17 avril 2015

Handlebars doesn't seem to call my controller function

I have a property on my controller, isLogin, bound to a handlebars conditional, {{#unless isLogin}}. But it doesn't seem to activate the function when the template is rendered. I inserted a console.log statement and that doesn't show up in the console either.


I have an application template like this:



<div id="header">
<div class="screen-line black"></div>
</div>
<div id="content">
<div class="pure-g">
<div class="pure-u-1-6">
{{#unless isLogin}}
<div class="nav pure-menu custom-restricted-width">
<ul class="pure-menu-list">
<li class="pure-menu-item"><div class="menu-item-icon fa fa-trello"></div>{{link-to "Classrooms" "classrooms" class="menu-item pure-menu-link"}}</li>
</ul>
</div>
{{/unless}}
</div>
<div class="pure-u-5-6" >
{{outlet}}
</div>
</div>
</div>
<div id="footer">
<div class="screen-line black"></div>
</div>


And a controller like this:



import Ember from 'ember';

export default Ember.Controller.extend({
isLogin : function(){
console.log("isLogin called");
return true;
}

});


Can you see what is wrong? Thanks





Aucun commentaire:

Enregistrer un commentaire