angular.js - Angular Require error
仅有的幸福
仅有的幸福 2017-05-15 17:07:07
0
2
1036

The structure is as follows:

-main.js
    
    requirejs.config({
        baseUrl: 'scripts',
        paths: {
            jQuery: 'lib/jquery/jquery',
            Angular: 'lib/angular/angular',
            angularRouter: 'lib/angular-route/angular-route',
        },
        shim: {
            'Angular': {
                deps: ['jQuery']
            },
            angularRouter: {
                deps: ['Angular'],
                exports: 'ngRoute'
            }
        }
    });
    
    // 手动开启angular服务
    require(['Angular','app'], function(angular){
        angular.element(document).ready(function(){
            angular.bootstrap(document,['yce-manage']);
        });
    
    });

-app.js



define(['Angular','angularRouter'],function(angular){

        var app = angular.module('yce-manage',['ngRoute']);


        return app;

    });
    
    

Error report:

angular.min.js:108 Error: [ng:areq] http://errors.angularjs.org/1.4.3/ng/areq?p0=mainController&p1=not%20a%20function%2C%20got%20undefined
at Error (native)
仅有的幸福
仅有的幸福

reply all(2)
世界只因有你

angular.min.js:108 Error: [ng:areq] http://errors.angularjs.org/1...
at Error (native)

mainController
not a function, got undefined
at Error (native)

黄舟

angualr doesn’t need to rely on jquery

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template