我想知道渲染任何模板时的事件或其他事件。
<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
});
}
});
示例.js
function clearObj(){
$("#username").val("");
$("#email").val("");
}
我将在呈现仪表板模板时运行 clearObj() 函数。我必须使用哪个事件或功能?
我可以通过在地址栏 /#/dashboard 上键入或单击某个按钮等来转到仪表板模板。