2015-09-28 27 views
0

遷移我有角應用具有以下定義:從角1.2.14到1.4.2中斷整個應用程序

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

當我已經改變了角度的版本,事情就破產了,控制檯拋出

未捕獲的錯誤:[$注射器:modulerr]與以下堆棧跟蹤:

錯誤:$注射器:modulerr 模塊錯誤

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 

我曾嘗試閱讀和理解angularJS官方遷移指南,但我coudn't能夠弄清楚它對我有什麼,因爲我沒有在我的代碼中使用$ animate(它的$ animate和$ touch只注入另一個插件的工作,即滑塊,我也用'ngROute任何地方')

有沒有人有想法應該在這裏做什麼,因爲我不知道我從哪裏開始:)

+0

你在線6上有什麼?在您的app.js中 –

+0

您的依賴與您使用的角度的新版本不兼容。轉到每個第三方站點,然後下載適用於angular 1.4.2的相應版本或相應地更改您的bower配置。 –

+0

Hello Babajide,以下是第5-6行的代碼,其中我使用HTTP攔截器攔截HTTP請求並顯示加載器: --------------------- - myApp.config(function($ httpProvider){ $ httpProvider.responseInterceptors.push('myHttpInterceptor'); // line 6 – Milan

回答

0

所以這裏是需要做什麼來遷移我的角應用程序。

  1. 遷移ngRoute和ngAnimate用相同的版本,在1.2和改變他們的角1.4

在我的情況下,風格角度

  • 刪除HTTP攔截,刪除$ httpProvider和遷移ngAnimate和ngRoute解決了我的問題。