How to upgrade AngularJS to the latest version in ionic app?

i have to upgrade angularJs 1.5.3 version to higher version.
should change the version existed in src/www/lib directory ?
how can i do that ?

Hi Ashok,

Running angularjs 1.5.3 is really old. Your might want to consider upgrading to angular 2+ versions however that could be a big adjustment.

Upgrading to 1.5.11 should be possible by updating it through npm or bower, whichever is applicable to your use case.

npm install angular@1.5.11

However you also might need to update some dependancies

i don’t think
npm install angular@1.5.11
will resolve my problem because i don’t have any angular version installed in my project.
i think i should update angular version in this section!
Sans titre

You are looking at your www/ folder. If im not mistaken this folder is completely generated.

You should look in the root of your project if it contain a package.json or bower.json file. There you can update the version number of the angular library, run an install command and that will update the lib folder in your www/ folder.

Never work in your www/ folder since it will be overwritten on every build.


here’s my package.json

{

  "name": "app_name",

  "author": "App Platform",

  "homepage": "http://app****.com/",

  "private": true,

  "scripts": {

    "clean": "ionic-app-scripts clean",

    "build": "ionic-app-scripts build  --dev",

    "ionic:build": "ionic-app-scripts build --dev",

    "ionic:serve": "ionic-app-scripts serve"

  },

  "config": {

    "ionic_source_map_type": "eval"

  },

  "dependencies": {

    "@angular/animations": "6.1.10",

    "@angular/cli": "^6.2.9",

    "@angular/common": "^6.1.10",

    "@angular/compiler": "6.1.10",

    "@angular/compiler-cli": "6.1.10",

    "@angular/core": "^6.1.10",

    "@angular/forms": "6.1.10",

    "@angular/http": "^6.1.10",

    "@angular/platform-browser": "6.1.10",

    "@angular/platform-browser-dynamic": "6.1.10",

    "@capacitor/android": "^1.2.1",

    "@capacitor/core": "^1.2.1",

    "@ionic-native/android-permissions": "^4.20.0",

    "@ionic-native/base64": "^5.22.0",

    "@ionic-native/call-number": "^5.28.0",

    "@ionic-native/camera": "^4.20.0",

    "@ionic-native/core": "4.20.0",

    "@ionic-native/document-viewer": "^4.20.0",

    "@ionic-native/downloader": "^5.26.0",

    "@ionic-native/fcm": "^4.20.0",

    "@ionic-native/file": "^4.20.0",

    "@ionic-native/file-opener": "^4.20.0",

    "@ionic-native/file-path": "4.20.0",

    "@ionic-native/file-transfer": "^4.20.0",

    "@ionic-native/firebase": "^4.20.0",

    "@ionic-native/firebase-authentication": "^4.20.0",

    "@ionic-native/image-resizer": "4.20.0",

    "@ionic-native/in-app-browser": "^4.20.0",

    "@ionic-native/launch-navigator": "^4.20.0",

    "@ionic-native/local-notifications": "^4.20.0",

    "@ionic-native/network": "^4.20.0",

    "@ionic-native/preview-any-file": "^5.27.0",

    "@ionic-native/push": "^4.20.0",

    "@ionic-native/qr-scanner": "^4.20.0",

    "@ionic-native/sms": "^5.36.0",

    "@ionic-native/splash-screen": "^4.20.0",

    "@ionic-native/status-bar": "4.20.0",

    "@ionic/angular": "4.11.2",

    "@ionic/storage": "^2.2.0",

    "@ionic/utils-subprocess": "^2.1.3",

    "@ngx-gallery/core": "2.0.1",

    "@ngx-gallery/gallerize": "2.0.1",

    "@ngx-gallery/lightbox": "2.0.1",

    "@types/html2canvas": "0.0.35",

    "@types/jspdf": "^1.3.3",

    "@types/lodash": "^4.14.116",

    "angular-font-awesome": "^3.1.2",

    "angular2-text-mask": "^9.0.0",

    "angularfire2": "^5.0.0-rc.3",

    "bn-ng-pdf-viewer": "^1.3.0",

    "bootstrap": "^3.4.1",

    "call-number": "^1.0.1",

    "cordova": "^10.0.0",

    "cordova-plugin-android-native-pdfviewer": "^1.2.0",

    "cordova-plugin-android-permissions": "^1.1.2",

    "cordova-plugin-compat": "^1.2.0",

    "cordova-plugin-console": " 1.1.0",

    "cordova-plugin-device": " 2.0.2",

    "cordova-plugin-document-viewer": "^0.9.13",

    "cordova-plugin-fcm": "^2.1.2",

    "cordova-plugin-file": "^6.0.2",

    "cordova-plugin-file-opener2": "^3.0.0",

    "cordova-plugin-file-transfer": "^1.7.1",

    "cordova-plugin-inappbrowser": "^4.0.0",

    "cordova-plugin-preview-any-file": "^0.1.6",

    "cordova-plugin-qrscanner": "^3.0.1",

    "cordova-plugin-statusbar": "^2.4.3",

    "cordova-plugin-whitelist": "^1.3.4",

    "cordova-res": "^0.14.0",

    "file-saver": "^2.0.2",

    "firebase": "^4.5.2",

    "flag-icon-css": "^3.5.0",

    "google-libphonenumber": "^3.2.25",

    "hammerjs": "^2.0.8",

    "html2canvas": "^1.0.0-rc.7",

    "integrator-cordova-plugin-downloader": "^1.1.0",

    "intl-input-phone": "0.0.7",

    "intl-tel-input": "^17.0.3",

    "ionic": "^5.4.16",

    "ionic-alpha-scroll": "^0.1.5",

    "ionic-angular": "3.9.5",

    "ionic-plugin-keyboard": "2.2.1",

    "ionic-text-mask": "^1.0.3",

    "ionic-tooltips": "^3.1.0",

    "ionic2-alpha-scroll": "^2.0.1",

    "ionicons": "3.0.0",

    "jspdf": "^2.3.1",

    "moment": "^2.24.0",

    "ng-dynamic": "3.0.2",

    "ng2-pdf-viewer": "^3.0.8",

    "ng2-pdfjs-viewer": "^5.0.7",

    "ng2-tel-input": "^2.3.0",

    "ngx-bootstrap": "^2.0.5",

    "ngx-extended-pdf-viewer": "^2.2.0-beta.1",

    "ngx-gallery": "^5.10.0",

    "ngx-intl-tel-input": "^3.0.5",

    "node-gyp": "^8.4.1",

    "node-sass": "^4.14.1",

    "promise-polyfill": "^8.2.0",

    "rxjs": "^6.6.7",

    "rxjs-compat": "^6.0.0-rc.0",

    "screenfull": "^3.3.0",

    "sw-toolbox": "3.6.0",

    "tslint-ionic-rules": "0.0.21",

    "typescript": "^3.9.7",

    "web-animations-js": "2.3.1",

    "zone.js": "0.8.29"

  },

  "devDependencies": {

    "@capacitor/cli": "^1.2.1",

    "@ionic/app-scripts": "^3.2.4",

    "@ionic/cli-plugin-cordova": "1.4.1",

    "@ionic/cli-plugin-ionic-angular": "1.3.2",

    "@ionic/lab": "3.1.7",

    "@types/node": "^14.17.1",

    "cordova-plugin-actionsheet": "^2.3.3",

    "cordova-plugin-androidx": "^3.0.0",

    "cordova-plugin-androidx-adapter": "^1.1.3",

    "cordova-plugin-badge": "^0.8.8",

    "cordova-plugin-dialogs": "^2.0.2",

    "cordova-plugin-firebase": "git+https://github.com/jestcastro/cordova-plugin-firebase.git",

    "cordova-plugin-firebase-analytics": "^6.0.1",

    "cordova-plugin-firebase-authentication": "^5.0.0",

    "cordova-plugin-firebase-messaging": "^6.0.0",

    "cordova-plugin-ionic-webview": " 4.1.2",

    "cordova-plugin-local-notification": "^0.9.0-beta.2",

    "cordova-plugin-network-information": "^2.0.2",

    "cordova-plugin-splashscreen": " 5.0.2",

    "cordova-sms-plugin": "^1.0.1",

    "cordova-support-android-plugin": "~1.0.0",

    "grunt": "^1.4.1",

    "grunt-contrib-jshint": " 2.1.0",

    "grunt-contrib-nodeunit": "^3.0.0",

    "grunt-contrib-uglify": " 4.0.1",

    "gulp": " 4.0.2",

    "gulp-clean-css": " 4.2.0",

    "gulp-dart-sass": "^1.0.2",

    "gulp-rename": "1.2.2",

    "gulp-replace": "0.5.4",

    "gulp-sass": "^3.2.1",

    "gulp-tslint": "6.1.2",

    "node-pre-gyp": "0.17.0",

    "phonegap-plugin-multidex": "^1.0.0",

    "sass": "^1.49.7",

    "ws": "3.3.2"

  },

  "cordovaPlugins": [

    "cordova-plugin-whitelist",

    "cordova-plugin-console",

    "cordova-plugin-device",

    "ionic-plugin-keyboard"

  ],

  "cordovaPlatforms": [

    "andoid",

    {

      "platform": "android",

      "version": "",

      "locator": "android"

    }

  ],

  "description": "Essyndic: vivons mieux ensemble !!!",

  "cordova": {

    "plugins": {

      "cordova-plugin-console": {},

      "cordova-plugin-device": {},

      "cordova-plugin-whitelist": {},

      "ionic-plugin-keyboard": {},

      "cordova-plugin-camera": {},

      "cordova-plugin-splashscreen": {},

      "cordova-plugin-ionic-webview": {

        "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"

      },

      "cordova-plugin-statusbar": {},

      "cordova-plugin-compat": {},

      "cordova-plugin-file-transfer": {},

      "cordova-plugin-file-opener2": {

        "ANDROID_SUPPORT_V4_VERSION": "27.+"

      },

      "cordova-plugin-file": {},

      "cordova-plugin-android-permissions": {},

      "integrator-cordova-plugin-downloader": {},

      "cordova-plugin-document-viewer": {},

      "cordova-plugin-preview-any-file": {},

      "mx.ferreyra.callnumber": {},

      "cordova-plugin-inappbrowser": {},

      "cordova-plugin-network-information": {},

      "cordova-plugin-qrscanner": {},

      "cordova-plugin-firebase-authentication": {

        "FIREBASE_AUTH_VERSION": "version",

        "ANDROID_FIREBASE_AUTH_VERSION": "21.0.+"

      },

      "cordova-plugin-firebase-messaging": {

        "ANDROID_FIREBASE_MESSAGING_VERSION": "22.0.+",

        "ANDROIDX_CORE_VERSION": "1.6.+"

      },

      "cordova-plugin-androidx-adapter": {},

      "cordova-plugin-androidx": {},

      "cordova-plugin-local-notification": {},

      "uk.co.workingedge.phonegap.plugin.launchnavigator": {

        "GOOGLE_API_KEY_FOR_ANDROID": "{AIzaSyDKPoxyq-*******}",

        "OKHTTP_VERSION": "3.12.0"

      },

      "cordova-plugin-firebase-analytics": {},

      "cordova-plugin-firebase": {},

      "cordova-sms-plugin": {}

    },

    "platforms": [

      "android"

    ]

  }

}

bower.json exists only in www/ folder and there’s no angular module mentioned in my package.json
when i make a global search, i only can find angular 1.5.3 version in www/ folder!

i have tried to execute this command npm install angular@1.5.11 then rebuild the app, but it doesn’t overwrite any thing in www/ folder!

That is a very interesting package.json I must say.

You are running multiple versions of ionic which I would say would be impossible to get running stable.

You have installed:
ionic 5.4.16
ionic-angular 3.9.5
and
@ionic/angular 4.11.2
@angular/core 6.1.10

The packages prefixed by the ‘@’ sign are newer and I would suggest you remove the other ones.

However, I would highly suggest you start a new ionic project from cli and start moving features/pages to that one-by-one. Your project contains so many packages of old angular/ionic versions that I won’t be able to see what’s supposed to be there and what’s not. It might be some work but trust me you’ll be thankful when maintaining this in the future.

ok i will make try.
thanks any way