在AngularJS中定义初始应用程序-Argument'fn'不是函数,获取字符串

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

本文关键字:函数 字符串 获取 fn AngularJS 应用程序 -Argument 定义      更新时间:2023-09-26

我使用更详细的语法来定义模块和应用程序。我有一个空白的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) {
            }]);