How to upgrade version of Angular in Ionic Framework?

I'm having problems with Angular filters, everyone says: this is because you are not using Angular version 1.3.8 or higher, I just understood my version by doing angular.version on the console and: Object {full: "1.3.6", major: 1, minor: 3, dot: 6, codeName: "robofunky-danceblaster"} appears, so how do I upgrade to 1.3.8? or upgrade to the latest version?

Is there a way to do this, or do I need to work with this version of Angular until Ionic people update it?

+5
source share
4 answers

ionic.bundle.js is a concatenation:

  • ionic.js
  • angular.js
  • angular-animate.js
  • angular-sanitize.js
  • angular-ui-router.js
  • ionic-angular.js

If you want to use a newer version of AngularJS than the one included in the kit, you can include them separately with your preferred version (instead of downloading ionic.bundle.js ).

Please note that the version of AngularJS included in the latest version of Ionic is the version that was / was used during testing (I assume). Thus, manually, including a newer version, Ionic may break.

+23
source

If you use Bower to manage your packages, you do not want to manually include another <script> for angular.

If you need to override the angular version (and you are using the gazebo), just add angular as a dependency in your bower.json, it should be ionic in the same place. Then indicate the version number. But keep in mind that, as tasseKATT says, this can disrupt ion mode if you use a different version of angular than expected ion.

If you still want to do this, you can do this in two ways. Using the bower command line tool or manually.

Bower Command Line:

At the root of your application, you can do the following, which will add the latest version of angular to your bower.json

 bower install angular --save 

Or manually:

 "dependencies": { "ionic": "driftyco/ionic-bower#1.2.4", "angular": "1.5.0" } 

Of course, using the bower command or manually, make sure that the resulting version specified in your bower.json is the one you want.

You may find that you need to add conflict resolution to bower.json in order to choose your version compared to a single ionic sentence. However, as tasseKATT says, this can upset the situation if you use an angular version different from the expected ionic one.

Unable to find a suitable version for angular, select one of them:

1) angular # 1.4.3, which is resolved to 1.4.3 and is required by ionic # 1.2.4

2) angular # ^ 1.5.0, which is allowed before 1.5.0 and is required by the product builder

3) angular #> = 1.0.8, which is allowed before 1.5.0 and requires angular -ui-router # 0.2.13

4) angular # ^ 1.x, which is allowed up to 1.5.0 and requires angular -local-storage # 0.2.5

5) angular # 1.5.0, which is allowed before 1.5.0 and requires angular -mocks # 1.5.0

6) angular # ^ 1.5.0, which resolved to 1.5.0

Then you select the option, prefix it! to save permission for bower.json or just add below and change it to the version you need:

 "resolutions": { "angular": "1.5.0" } 

So, now your project will say: “I need an angular version of X”, and then Ionic says that I need another, but in your bower.json you specify what to override. If you want to explore this more, look at the bower.json file in bower_components / ionic / bower.json (there is also .bower.json, not quite sure of the difference here.

Once you have done everything, so final:

 bower update 

And it checks that everything is happy and established. Then there will be any other conflicts that you can resolve using the methods above.

+5
source

This is all you need to do:

 ionic lib update 

see the Github documentation !

+4
source

Note points at the excellent Plunker from @tasseKATT above:

  • version of angular in index.html for example. <script src="https://code.angularjs.org/1.5.0-beta.2/angular.js"></script> must precede the inclusion of ionic.bundle.js
  • you may need to add https://code.angularjs.org:* to <meta http-equiv="Content-Security-Policy" ...
  • You can verify that you have downloaded the correct version in the browser console using angular.version
0
source

Source: https://habr.com/ru/post/1212834/


All Articles