首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >levels多级深层名称空间

levels多级深层名称空间
EN

Stack Overflow用户
提问于 2013-03-22 04:58:19
回答 1查看 361关注 0票数 1
代码语言:javascript
复制
App.ApplicationRoute = Ember.Route.extend({
    setupController: function(){
        this.controllerFor('App.Namespace1.Object1').set('model', model);
    }    
});

App.Namespace1.Object1Controller = Ember.ObjectController.extend({});

这行得通

代码语言:javascript
复制
App.ApplicationRoute = Ember.Route.extend({
    setupController: function(){
        this.controllerFor('App.Object1').set('model', model);
    }    
});

App.Object1Controller = Ember.ObjectController.extend({});

这就是我看到的错误。

代码语言:javascript
复制
Error: assertion failed: You are trying to look up a controller that you did 
not define, and for which Ember does not know the model.

This is not a controller for a route, so you must explicitly define the controller 
(Minerva.Namespace1Object1Controller) or pass a model as the second parameter to 
`controllerFor`, so that Ember knows which type of controller to create for you.
http://localhost:8090/EmberApplication/js/vendor/ember-1.0.0-pre.2.js
Line 53

EmberJS是否支持多层深度的命名空间?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-03-22 21:41:29

好消息!我刚刚删除了我以前的答案,因为仔细检查Ember.Resolver中的代码可以发现以下内容是可能的:

代码语言:javascript
复制
this.controllerFor('App/Namespace1/object1')

(约定是在以小写表示的路线上下文中提及控制器)

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15563026

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档