Error: [ng:areq] Argument 'xxxx' is not a function, got undefined

"Error: [ng:areq] Argument 'keywords' is not a function, got undefined"

代码类似这样的:

<div ng-app="xxxx" ng-controller="xxxx">
//...
</div>
var app = angular.module("xxxx", []);
app.controller('xxxx', function ($scope, $http, $state) {});

本来应该不会有问题,但是经过路由配置之后,就出现了这样的问题,我完全就是新建了一个页面,

然后复制一下html和js文件而已,怎么会报错呢...结果问了下对Angular熟悉的人才知道:该这么配置...

第一种解决方案:要么在路由配置那里写入:

var app = angular.module('app', ["old_1", "old_2", "old_3", "xxxx"]);

第二种解决方案:要么修改新建的页面和js:

<div ng-controller="xxxx">
//...
</div>
app.controller('xxxx', function ($scope, $http, $state) {});

好吧、我选的第二种,能扩展的别修改,GG。。。

posted @ 2016-10-28 15:27  zh89233  阅读(1884)  评论(2编辑  收藏  举报