0
我嘗試在Ember.js中使用路由,但它似乎沒有正常工作。在Ember.js中路由
完整的代碼here on Github,但部分低於:
define(['ember', 'app/controllers/controller', 'app/views/view'], function (ember, controller, view) {
var Router = Ember.Router.extend({
root: Ember.State.extend({
index: Ember.State.extend({
// location: Ember.Location.create({style: 'hash'}),
location: 'hash',
enableLogging: true,
route: '/',
redirectsTo: 'news.index'
}),
news: Ember.State.extend({
route: '/news',
// showPost : Ember.State.transitionTo('post'),
test: Ember.ViewState.extend({
route: '/test',
view: view.appendTo('body')
}),
index: Ember.ViewState.extend({
route: '/',
view: null
})
})
})
});
var router = Router.create({});
return router;
});
你有什麼錯誤?路線沒有被正確地遵守?請給出更多的輸出 – nembleton