您的位置:首页 > 编程语言 > Go语言

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

2016-10-28 15:27 1146 查看
"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。。。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: