繁体   English   中英

在AngularJS中定义初始应用程序-参数'fn'不是一个函数,得到了字符串

[英]Defining The Initial App in AngularJS - Argument 'fn' is not a function, got string

我正在使用更详细的语法来定义模块和应用程序。 我有空白的HTML页面,该页面先插入angular.js,然后再插入该文件(app.js),但出现错误

未捕获的错误:参数'fn'不是函数,从testapp获得了字符串。

我是否有错字或误解了参数。 不知道我在做什么错。

文件:app.js

    angular.module('testapp.common', []);
    angular.module('testapp.controllers', []);
    angular.module('testapp.services', []);

    angular.module('testapp', ['testapp.controllers', 'testapp.common', 'testapp.services'], function ($httpProvider) {

    });

这应该是这样的

    angular.module('testapp.common', []);
    angular.module('testapp.controllers', []);
    angular.module('testapp.services', []);

    angular.module('testapp', ['testapp.controllers', 'testapp.common', 'testapp.services'])
           .config(['$routeProvider', '$httpProvider', function ($routeProvider, $httpProvider) {
            }]);

暂无
暂无

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

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