0
我是新的emberJS。我试图让自己的头脑明白, Route-Template-Controller-View-Model。更改模型/控制器中的特定模板emberJS
这里是我的代码:// app.js
App.IndexRoute = Ember.Route.extend({
model: function() {
return App.FIXTURES; // some data for the index route
},
setupController: function(controller, model) {
var self = this;
// sets the model for the current route
controller.set('model', model);
// render the dashboard template,
// Problem: I want the model of this template 'dashboard' to be changed,
// how can I achieved that?
self.render('dashboard', {
// Is this correct here? I pass an anonymous function to change the controller?
// I got an error for doing so
controller: function() {
console.log(this);
}
});
}
});
嗨,'self.render('仪表板')'有另一个模板要呈现。因为我想让模板的模型设置为另一个模型,可能吗?或者我的做法是错误的? – meetmahpuppy 2014-10-06 07:54:07
@meetmahpuppy如果您想要在视图模板中加载模板,您可以使用'{{render}}帮助程序将其加载到指定的模型中http://emberjs.com/guides/templates/rendering-with-helpers / – Jakeii 2014-10-06 09:39:18