【发布时间】:2014-11-14 05:05:38
【问题描述】:
我一直在使用angular-seed 作为入门项目,尽管它在过去一个月左右改变了它的应用程序结构,但我还是决定看看angular-sprout。
Angular-sprout 没有更新的 index-async 页面,所以我决定分叉代码并着手处理它。我已经正确连接了所有东西,但是现在当我尝试添加控制器时(通过 module.controller() 函数,我收到一条错误消息,指出 module.controller 未定义。
当我在我的index-async.html 页面上将angular.module('myModule') 登录到控制台时,我得到一个具有正确方法的角度对象 - filter()、service()、provider() 等 - 但controller 不是那里:
module Object {
_invokeQueue: Array[0],
_runBlocks: Array[0],
requires: Array[0],
name: "application.controllers",
provider: function…}
_invokeQueue: Array[0]
_runBlocks: Array[0]
config: function (){c[d||"push"]([a,b,arguments]);return g}
constant: function (){c[d||"push"]([a,b,arguments]);return g}
directive: function (){c[d||"push"]([a,b,arguments]);return g}
factory: function (){c[d||"push"]([a,b,arguments]);return g}
filter: function (){c[d||"push"]([a,b,arguments]);return g}
name: "application.controllers"provider: function (){c[d||"push"]([a,b,arguments]);return g}
requires: Array[0]run: function (a){d.push(a);return this}
service: function (){c[d||"push"]([a,b,arguments]);return g}
value: function (){c[d||"push"]([a,b,arguments]);return g}
__proto__: Object
}
(对于糟糕的格式感到抱歉。我会尝试获得更好的控制台副本。)
当我从 index-async 记录 controller 时:
controller undefined details-controller.js:13
当我运行 index-async 页面时会发生这种情况。但是,在常规索引页面上,controller 被正确定义并给了我一个角度方法:
controller function () {
invokeQueue[insertMethod || 'push']([provider, method, arguments]);
return moduleInstance;
} details-controller.js:13
以前有人遇到过这种情况吗?对于它的价值,似乎controller 是我缺少的唯一模块方法,我完全不知道为什么会这样。
【问题讨论】:
标签: javascript angularjs controller