RequireJS+Angularjs+angular-ui-router 集成报错。

jy69LrJop 2017-07-03 10:45:26
本人集成angular-1.6.4,requirejs,angular-ui-router的时候报这个错。
吧友们有没有遇到过的啊。本人怀疑是版本问题,但又不知道怎么验证,比较JS包版本控制这方面不熟悉。
下面贴代码
main.js

require.config({
baseUrl:"/",
paths:{
'jquery':'lib/jquery-3.1.1.min',
'angular':'lib/angularjs/angular',
'angular-ui-router':'lib/angular-ui-router/angular-ui-router',
'app':'modules/app',
},
shim:{
'angular':{
deps:['jquery']
},
'angular-ui-router':{
deps:['angular']
},
'app':{
deps:[
'angular-ui-router',
]
},
}
});
require(['app'],function(){
// angular.bootstrap(document,['app']);
});


app.js

define(function(){
var app = angular.module('app',['ui.router','core']);

app.constant('menudt', {
"1001":"/customerbinfo",
"1002":"/relcustinfo",
"2001":"/creditapproval",
"9001":"/menumanager"
});

app.config(['$stateProvider','$urlRouterProvider',function($stateProvider,$urlRouterProvider) {

$stateProvider.state({
name:'login',
url:'/login',
templateUrl:'tpls/login.html',
});
$stateProvider.state({
name:'home',
url:'/home',
templateUrl:"tpls/home.html",
});
$stateProvider.state({
name:'index',
url:'/index',
component:'index',
});

$urlRouterProvider.otherwise('/index');
}]);

require(['controllers/references'],function(references){
require(references,function(){
angular.bootstrap(document,['app','core']);
});
});
});


core.js

define(function(){
var core = angular.module('core',[]);
core.component('index',{
template:'<h1>....</h1>',
controller:'CoreController',
});
core.service('validate', ['$http', function($http){
this.login = function(successFunc){
$http.get("/server/valilogin?r"+Math.random(),{
cache:false,
}).then(successFunc,function(response){
});
};
}]);

core.service('getdata', ['$http', function($http){
this.getmenudt = function(successFunc){
$http.get("/data/menu.json",{headers:{
'Content-Type':'application/json'
},cache:false}).then(successFunc,function(response){
console.log(response)
});
};
}]);

core.controller('CoreController', ['$scope','$location','validate','getdata',
function($scope,$location,validate,getdata){
validate.login(function(response){
var rs = response.data
if(rs.Result != null){
if (rs.Result == "error" ){
$location.path("/login")
} else {
//$location.path("/home")
}
}
});

}]);
});


references.js

define(function(){
return [
'controllers/core',
];
});


各位大大求救啊。困扰了一周了!!!
完整错误:
angular.js:14525 TypeError: Cannot read property 'noop' of undefined
at Object.<anonymous> (angular-ui-router.js:9719)
at angular.js:1346
at invokeLinkFn (angular.js:10426)
at nodeLinkFn (angular.js:9815)
at compositeLinkFn (angular.js:9055)
at publicLinkFn (angular.js:8920)
at lazyCompilation (angular.js:9311)
at updateView (angular-ui-router.js:9668)
at Object.<anonymous> (angular-ui-router.js:9615)
at angular.js:1346 "<div ui-view="" class="ng-scope">"
...全文
116 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复
01 bootstrap The most popular front-end framework for developing responsive, mobile first projects on the web. 02 angular.js AngularJS is an MVC framework for building web applications. The core features include HTML enhanced with custom component and data-binding capabilities, dependency injection and strong focus on simplicity, testability, maintainability and boiler-plate reduction. 03 angular-i18n Locales for AngularJS 04 jquery jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. 05 jqueryui jQuery UI provides abstractions for low-level interaction and animation, advanced effects and high-level, themeable widgets, built on top of the jQuery JavaScript Library, that you can use to build highly interactive web applications. 06 angular-ui-bootstrap Native AngularJS (Angular) directives for Bootstrap. Small footprint (5kB gzipped!), no 3rd party JS dependencies (jQuery, bootstrap JS) required! 07 require.js RequireJS is a JavaScript file and module loader. It is optimized for in-browser use, but it can be used in other JavaScript environments, like Rhino and Node 08 angular-ui AngularUI is the companion suite to the AngularJS framework. 09 angular-ui-utils AngularUI is the companion suite to the AngularJS framework. 10 angular-ui-sortable This directive allows you to jQueryUI Sortable. 11 angular-ui-select 12 angular-ui-router State-based routing for AngularJS 13 angular-ui-date This directive allows you to add a date-picker to your form elements. 14 angular-ui-calendar A complete AngularJS directive for the Arshaw FullCalendar. 15 require-i18n Load string bundles used in internationalization (i18n) that are made up of separate country/language/locale-specific bundles. 16 json2 This file creates a global JSON object containing two methods: stringify and parse. 17 jsPlumb jsPlumb provides a means for a developer to visually connect elements on their web pages.

87,907

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧