结构如下:
-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)
世界只因有你2017-05-15 17:09:07
angular.min.js:108 错误:[ng:areq] http://errors.angularjs.org/1...
at 错误(本机)
mainController
不是一个函数,未定义
错误(本机)