0

I really just want to render a template, nothing special here.

$(document).on('ready',function(){
    console.log('.foot rendering');

    var FooterView = Ember.View.extend({
        templateName: 'footer'
    }).create().appendTo("body");

});

The template renders correctly, but the debugger gives me the following error:

DEPRECATION: Using the defaultContainer is no longer supported. [defaultContainer#lookup]

Can someone point me toward the proper way to render this template?

UPDATE It looks like just using the handlebars templates directly is the way to go here.

$(document).on('ready',function(){
   console.log('.foot rendering');
   var footTemplate = Handlebars.compile($("#footer").html()); 
   var footContext = {}; // ... 
   $("body").append(footTemplate(footContext)); 
});
4

2 回答 2

0

you can use the partial helper to render your template.For your case,put the following code inside the body tag. {{partial "footer"}} For more details refer this emberjsdoc.

于 2013-10-04T15:38:01.343 回答
0

I think that isn't a good idea to use ember without the router. Because the router setup the container in the views when connecting the outlets.

If you want to make your sample work, just pass the App.__container__ to your view container property:

App = Ember.Application.create();

$(document).ready(function(){    
    console.log('.foot rendering');
    App.FooterView = Ember.View.extend({
        templateName: 'footer'
    }).create({ 
        container: App.__container__ 
    }).appendTo("body");
});

But, this isn't a good pratice.

The discussion about the default container deprecation is here https://gist.github.com/stefanpenner/5627411

于 2013-10-04T18:48:21.840 回答