我怀疑此问题可能与我的路由或我的视图有关。以下是:
App.router = Ember.Router.create({
enableLogging: true,
location: 'history',
root: Ember.Route.extend({
index: Ember.Route.extend({
route: '/admin/',
redirectsTo: 'login'
}),
login: Ember.Route.extend({
route: '/admin/login/',
doLogin: function(router, context) {
"use strict";
router.transitionTo('dashboard', context);
},
connectOutlets: function (router, context) {
"use strict";
router.get('applicationController').connectOutlet('login', "login");
}
}),
dashboard: Ember.Route.extend({
route: '/admin/dashboard/',
doLogout: function(router, context) {
"use strict";
router.transitionTo('login', context);
},
connectOutlets: function (router, context) {
"use strict";
router.get('applicationController').connectOutlet('sidebar', 'sidebar');
router.get('applicationController').connectOutlet('toolbar', 'toolbar');
router.get('applicationController').connectOutlet('dashboard', 'dashboard');
}
}),
articles: Ember.Route.extend({
route: '/admin/articles/',
connectOutlets: function (router, context) {
"use strict";
console.log("here");
router.get('applicationController').connectOutlet('sidebar', 'sidebar');
router.get('applicationController').connectOutlet('toolbar', 'toolbar');
router.get('applicationController').connectOutlet('articles', 'articles');
}
})
})
});
我的观点是:
<script type="text/x-handlebars" data-template-name="sidebar">
<div class="logo">
<img src="http://boxed.hu/static/boxed.hu/images/sitebuild/logo.png">
</div>
<ul>
<li>
<a id="dashboardMenu" href="" data-module="dashboard" class="selected" {{action dashboard}}>
Dashboard
<span class="icon-home"></span>
</a>
</li>
<li>
<a id="articlesMenu" href="" data-module="articles" class="" {{action articles}}>
Articles
<span class="icon-copy"></span>
</a>
</li>
<li>
<a id="mediaMenu" href="" data-module="media" class="" {{action media}}>
Media
<span class="icon-picture"></span>
</a>
</li>
<li>
<a id="pagesMenu" href="" data-module="pages" class="" {{action pages}}>
Pages
<span class="icon-file"></span>
</a>
</li>
<li>
<a id="commentsMenu" href="" data-module="comments" class="" {{action comments}}>
Comments
<span class="icon-comments"></span>
</a>
</li>
<li>
<a id="usersMenu" href="" data-module="users" class="" {{action users}}>
Users
<span class="icon-user"></span>
</a>
</li>
<li>
<a id="rolesMenu" href="" data-module="roles" class="" {{action roles}}>
Roles
<span class="icon-unlock"></span>
</a>
</li>
</ul>
</script>
当我点击列表中的一个元素时,我得到了这个控制台输出:
STATEMANAGER: Sending event 'articles' to state root.
TypeError: can't redefine non-configurable property '__ember1346625712617'
[Break On This Error]
o_defineProperty(this, GUID_KEY, undefinedDescriptor);
我打算调试代码,但我认为这里的帖子可能会给我的调试带来更快的答案。
答案 0 :(得分:3)
这不是Ember错误,而是浏览器错误:Error in accessor property: can't redefine non-configurable property 'status'。
我怀疑你是因为将一个动作({{action articles}}
)命名为一个状态而将其视为结果。