[英]Ember.js View and params
I have an Ember.js route like this: 我有一条Ember.js这样的路线:
this.route 'doc', path: '/docs/:doc'
And I need to set the template based on the :doc
param. 我需要根据:doc
param设置模板。 How can I achieve this? 我怎样才能做到这一点?
Thanks. 谢谢。
Maybe you could try something like this: 也许你可以尝试这样的事情:
App.DocView = Ember.View.extend({
render : function(buffer){
var context = this.get("context.content");
this.set("templateName", context);
this._super(buffer);
}
});
Link to Fiddle: http://jsfiddle.net/mavilein/DQ8gS/2/ 链接到小提琴: http : //jsfiddle.net/mavilein/DQ8gS/2/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.