mardi 14 avril 2015

How to get (needs included) controllers from a template in ember.js?

I have a controller that proxies up a parent controllers model so I can get ask if a property is undefined or not.


import Ember from "ember";



export default Ember.Controller.extend({
needs: "todos",
isLoaded: function() {
return this.get("controllers.todos.model.isLoaded");
}.property("controllers.todos.model.isLoaded")
});


I'd much prefer to pull this in a template directly but when I do the following my tests hang as it doesn't appear to be legit syntax



{{if controllers.todos.model.isLoaded}}
{{/if}}


Yet I know (in ember 1.11) you can still use controller (singular)



{{#if controller.content}}
{{/if}}


Is it possible to shorthand this computed or even include this in a template? If nothing else I could create a hbs helper (assuming I can get controllers from that scope).





Aucun commentaire:

Enregistrer un commentaire