Angularjs 从Angular 1.2.14迁移到1.4.2会中断整个应用程序
我有以下定义的angular应用程序:Angularjs 从Angular 1.2.14迁移到1.4.2会中断整个应用程序,angularjs,migrate,Angularjs,Migrate,我有以下定义的angular应用程序: var myApp = angular.module('myApp', ['ngRoute','infinite-scroll','geolocation', 'ngAnimate', 'ngTouch','ui.filters', 'AxelSoft','angularLazyImg','wu.masonry','ui.bootstrap','ngSanitize']); 到目前为止,我一直在使用AngularJS版本1.2.14。现在我需要使用Ang
var myApp = angular.module('myApp', ['ngRoute','infinite-scroll','geolocation', 'ngAnimate', 'ngTouch','ui.filters', 'AxelSoft','angularLazyImg','wu.masonry','ui.bootstrap','ngSanitize']);
到目前为止,我一直在使用AngularJS版本1.2.14。现在我需要使用AngularJS表单验证,为了做到这一点,我决定迁移到Angular的最新稳定版本1.4.2
当我改变了角度的版本,事情就坏了,控制台抛出
未捕获错误:[$injector:modulerr],堆栈跟踪如下:
错误:$injector:moduler
模块错误
我已经试着阅读和理解angularJS官方迁移指南,但我无法理解其中的内容,因为我的代码中没有使用$animate,$animate和$touch只为另一个插件注入,即滑块,我还使用了“ngROute anywhere”
有人知道应该在这里做些什么吗?因为我不知道从哪里开始:所以这里是迁移我的angular应用程序需要做的事情 使用相同版本的angular迁移ngRoute和ngAnimate 删除1.2中的HTTP拦截器,并将其更改为angular 1.4的样式
在我的例子中,删除$httpProvider并迁移ngAnimate和ngRoute解决了我的问题。第6行有什么内容?在app.js中,您的依赖项与您正在使用的angular的新版本不兼容。转到每个第三方站点,然后下载适合angular 1.4.2的版本,或者相应地更改您的bower配置。您好,Babajide,下面是第5-6行的代码,我在其中使用HTTP拦截器拦截HTTP请求并显示加载器:--------------myApp.configfunction$httpProvider{$httpProvider.responseInterceptors.push'myHttpInterceptor';//第6行
Failed to instantiate module myApp due to:
TypeError: Cannot read property 'push' of undefined
at http://localhost:8000/static/mobile/js/angularApp/app.js:6:37
at Object.e [as invoke] (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js:39:156)
at d (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js:37:328)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js:37:452
at m (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js:7:322)
at g (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js:37:229)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js:37:398
at m (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js:7:322)
at g (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js:37:229)
at eb (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js:40:503