SuperMarco
SuperMarco

Reputation: 721

Emberjs outlet inside a component

It is possible to have an {{outlet}} helper inside a component ?

With a router like this :

Router.map(function() {
    this.resource('pages', function(){
        this.resource( 'page', { path: '/:id' }, function(){
            this.route('edit');

        });
    });
});

I'm using my component as pages, and it display a list of page. I have set a {{link-to}} to each page to render the page template inside my component. (Page template is not a component)

Is it possible ? because it's not doing anything, so far my app is routing to /pages/page_id but the nested template is not display inside my component.

Is outlet not working within a component ?

Thanks for the help.

[EDIT] Here is a small example of what it looks like :

Component :

<div class="nestedTemplate">
{{outlet}}
</div>

<div>
{{#each item in model}}
    {{partial "list-row"}}
{{else}}
    {{partial "no-items"}} 
{{/each}}
</div>

The partial is just the list formatted correctly. with a {{link-to}} around each div.

Upvotes: 0

Views: 922

Answers (1)

givanse
givanse

Reputation: 14943

No, is not possible. You can either pass property values to the component or use the {{yield}} helper. See: http://emberjs.com/api/classes/Ember.Handlebars.helpers.html#method_yield

Upvotes: 1

Related Questions