mardi 8 décembre 2015

How to pass dynamic segment to ember component

How do I pass a dynamic segment in my url to a component? I can get the parameters in my model but i have no idea, how to pass that on to the component. What I do right now is:

export default Ember.Route.extend({
    sectionId: 0,

    model(params) {
        this.set('sectionId', params.section_id);
        return this.store.findAll('content');
    }
});

And in the Template:

{{#component id=sectionId}}{{/component}}

But when I log the id in my component, it says undefined.




Aucun commentaire:

Enregistrer un commentaire