I\'m trying to use Bootstrap Popover with EmberJS, so that the content of the popover will be a ember/handlebars template (with binding etc). How can this be done? (Ember 1.0.0-
I ran into this problem as well and had the same problem Robert mentioned above where the acceptable solution simply doesn't scale well to more complicated scenarios.
I ran into a very elegant fix, but I'm not sure how future-friendly it is. I'm taking advantage of the function renderToBuffer - see below:
//make your popover view to be created later
App.PopoverView = Ember.View.extend({
templateName : 'name-of-your-template-with-content'
});
//then you make your link that will trigger the popover
App.PopoverLinkView = Ember.View.extend({
tagName : 'a',
didInsertElement : function(){
var that = this;
this.$().popover({
'html' : true,
'content' : function(el){
var detailView = App.PopoverView.create();
var html = detailView.renderToBuffer().buffer;
return html;
}
});
}
});
The advantage here is that you can pass in a model and make things dynamic. Haven't tested it thoroughly, but wanted to get this out there to potentially help others.