angular.js - Angular Require 报错
仅有的幸福
仅有的幸福 2017-05-15 17:07:07
0
2
1038

结构如下:

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

    });
    
    

报错:

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)
仅有的幸福
仅有的幸福

Antworte allen(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 不用依赖jquery吧

Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage