結構如下:
-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)
angular.min.js:108 錯誤:[ng:areq] http://errors.angularjs.org/1...
at 錯誤(本機)
mainController
不是一個函數,未定義
錯誤(本機)
angualr 不用依賴jquery吧