Ember.js 如何使用connectOutlet
我创建了一个简单的测试,尝试使用connectOutlet。然而,渲染的内容并不多。以下是我的测试代码: 仅对应用程序进行总结。我认为问题在下面的代码中Ember.js 如何使用connectOutlet,ember.js,ember-router,ember-old-router,outlet,Ember.js,Ember Router,Ember Old Router,Outlet,我创建了一个简单的测试,尝试使用connectOutlet。然而,渲染的内容并不多。以下是我的测试代码: 仅对应用程序进行总结。我认为问题在下面的代码中 App.Router.map(function(match) { match('/').to('index'); }); App.IndexRoute = Em.Route.extend({ connectOutlets: function(router) { router.get('applicat
App.Router.map(function(match) {
match('/').to('index');
});
App.IndexRoute = Em.Route.extend({
connectOutlets: function(router) {
router.get('applicationController').connectOutlet('sidebar', 'navigation');
router.get('applicationController').connectOutlet('content');
}
});
有什么建议这个代码有什么问题吗
此外,在我在web上找到的几乎所有示例代码中,我都看到App.Router是被定义的
App.Router = Em.Router.extend({
enableLogging: true,
root: Em.Route.extend({
index: Em.Route.extend({
route: '/',
connectOutlets: function(router) {
.... etc ....
因为在ember最新的App.Router中已经定义了路由器,我想这是定义路由器的老方法吧 我从你的小提琴上看到你在用pre-2。最新版本是pre-4,所以我建议您使用它。是最新的pre-4 我创建了一个提琴,并将您的代码作为起点,最后得出了我认为您试图实现的目标: 基本上,连接插座被替换为
this.render('content', {into: 'index', outlet:'content');
在新的路由API中还有很多其他的变化。再次浏览网站上的指南,全面了解所有内容
希望这有帮助 我从你的小提琴上看到你在用pre-2。最新版本是pre-4,所以我建议您使用它。是最新的pre-4 我创建了一个提琴,并将您的代码作为起点,最后得出了我认为您试图实现的目标: 基本上,连接插座被替换为
this.render('content', {into: 'index', outlet:'content');
在新的路由API中还有很多其他的变化。再次浏览网站上的指南,全面了解所有内容
希望这有帮助