简体   繁体   English

AngularAMD无法在r.js之后加载控制器

[英]AngularAMD fails to load controller after r.js

It seems like I miss running r.js over code with AngularAMD. 好像我想念通过AngularAMD在代码上运行r.js一样。

.when('/', angularAMD.route({
    templateUrl: 'views/home.html',
    controller: 'HomeCtrl',
    controllerUrl: 'controllers/home',
    data: {
          name: 'home'
    }
}))

I have the following route defined which works fine as long as I don't run r.js, but after I do I'm getting the following error, 我定义了以下路由,只要我不运行r.js,它就可以正常工作,但是在我得到以下错误之后,

Uncaught Error: undefined missing controllers/home

Is the name of your js file for the home controller named home.js ? 主控制器的js文件名称是否为home.js

If not - then you will want the controllerUrl to equal the exact name without the .js at the end. 如果不是,那么您将希望controllerUrl等于确切的名称,但结尾没有.js - controllers/homeCtrl or controllers/homeController - mattering if that is how you've named your controller's js file. controllers/homeCtrlcontrollers/homeController是您如何命名控制器的js文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM