0
我想知道任何模板呈现时的事件或其他人。EmberJs中的模板呈现
<script type="text/x-handlebars" id="dashboard">
<span>username</span><input type="text" id="username" />
<span>email addr</span><input type="text" id="email" />
</script>
App.Router.map(function() {
this.resource('index', { path: '/' }, function() {});
this.resource('dashboard', {path: '/dashboard'}, function() {});
});
App.DashboardController = Ember.ObjectController.extend({})
App.DashboardRoute = Ember.Route.extend({
renderTemplate: function() {
this.render('dashboard', { // the template to render
controller: 'dashboard' // the controller to use for the template
});
}
});
sample.js
function clearObj(){
$("#username").val("");
$("#email").val("");
}
我要去当仪表板模板呈现运行clearObj()函数。 我必须使用哪个事件或功能?
我可以通过键入在地址栏/#/仪表板或点击一些按钮等
它工作得很好:) –