我似乎无法弄清楚如何显示mvc文件的内容,即视图模板和路径。
我在/routes/application.js
中有这段代码sample.Routers = sample.Routers || {};
(function () {
'use strict';
sample.Routers.ApplicationRouter = Backbone.Router.extend({
routes: {
'' : function () {
alert('Home');
},
'view': function () {
alert('View');
}
}
});
Backbone.history.start({pushState: true});
})();
感谢
答案 0 :(得分:0)
当我将命令yo backbone:all
运行到此
var AppRouter = Backbone.Router.extend ({
routes: {
'' : 'home',
'view': 'viewImage'
}
});
var appRouter = new AppRouter();
appRouter.on('route:home', function () {
console.log('im home');
});
appRouter.on('route:viewImage', function() {
alert('hey');
// console.log('view');
});
Backbone.history.start({pushState: true});