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。。。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM