Is it possible to load handlebar template with script tag? Or define handlebar templates programmatically in Ember.js

后端 未结 8 519
臣服心动
臣服心动 2021-01-31 10:38

Simply enough I do not want to define all my handlebar templates in my html file

I tried this



        
8条回答
  •  滥情空心
    2021-01-31 10:45

    Here's another solution, inside your Ember view/component:

    var viewClass = Ember.View.extend({ templateName: this.get('contentTemplate') });
    var view = this.createChildView(viewClass);
    var html = view.renderToBuffer().buffer;
    

提交回复
热议问题