lundi 11 mai 2015

Ember.js TypeError: parent is null

I am trying to assign a variable to a controller, initially set to null, and then display a conditional a template based on this variable.

Here's my route definition:

App.IndexRoute = Ember.Route.extend({
    setupController: function(controller, model) {
        this._super(controller, model);
        controller.set('suggestion', null);
    }
});

And here's part of my index.html:

<script type="text/x-handlebars" id="index">
    {{log suggestion}}
    {{#if suggestion}}
        <p>There is a suggestion</p>
    {{else}}
        <p>NO suggestion</p>
    {{/if}}
</script>

However, the above generates a TypeError: parent is null and nothing else happens. If I remove the conditional, everything works.

What's the problem and what does that error refer to? Lastly, how can I get more context for such errors?




Aucun commentaire:

Enregistrer un commentaire