使用requirejs + angular无法使用模块

时间:2014-10-26 14:08:04

标签: angularjs requirejs

我的app.js文件包含以下配置:

require.config({
    paths: {
        // vendors
        'angular': 'vendor/angular',
        'ngResource': 'vendor/angular-resource.min',
        'ngRoute': 'vendor/angular-route.min',
        'ngAnimate': 'vendor/angular-animate.min'
    },
    shim: {
        ngAnimate: {
            deps: ['angular']
        },
        angular: {
            deps: [],
            exports: 'angular'
        },
        ngRoute: {
            deps: ['angular']
        },
        ngResource: {
            deps: ['angular']
        }
    },
    baseUrl: 'scripts'
});

现在我正在尝试实例化角度槽需要:

define("app", ["angular", "ngResource"], function (angular) {
    var app = angular.module("app", ["ngResource"]);
    // you can do some more stuff here like calling app.factory()...
    return app;
});

但它抛弃了:

Module 'app' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

我正在逐步关注this guide。 我在这做错了什么?

0 个答案:

没有答案