Bower and ionic: adding angular-resource the right way?

hi,

naive question I have a simple ionic app with bower.json

{
  "name": "IonicCordovaExample",
  "private": "true",
  "devDependencies": {
"ionic": "driftyco/ionic-bower#1.0.0-beta.7"
  }
}

then i like to add angualr-resource:

  ...
  "devDependencies": {
"ionic": "driftyco/ionic-bower#1.0.0-beta.7",
"angular-resource": "1.2.17"
  }
  ..

but this starts to load in angular 1.2.18 and ends with:

$ bower install
bower cached        git://github.com/angular/bower-angular-resource.git#1.2.17
bower validate      1.2.17 against git://github.com/angular/bower-angular-resource.git#1.2.17
bower cached        git://github.com/angular/bower-angular.git#1.2.17
bower validate      1.2.17 against git://github.com/angular/bower-angular.git#1.2.17
bower cached        git://github.com/angular/bower-angular.git#1.2.18
bower validate      1.2.18 against git://github.com/angular/bower-angular.git#1.2.18
bower cached        git://github.com/angular/bower-angular.git#1.2.18
bower validate      1.2.18 against git://github.com/angular/bower-angular.git#>= 1.0.8

Unable to find a suitable version for angular, please choose one:
    1) angular#1.2.17 which resolved to 1.2.17 and is required by angular-resource#1.2.17 
    2) angular#~1.2.17 which resolved to 1.2.18 and is required by ionic#1.0.0-beta.7 
    3) angular#1.2.18 which resolved to 1.2.18 and is required by angular-animate#1.2.18 
    4) angular#>= 1.0.8 which resolved to 1.2.18 and is required by angular-ui-router#0.2.10

Prefix the choice with ! to persist it to bower.json


[?] Answer:
...

ok what did i mis ?

thx

pelle

1 Like

one more thing: well i choosed answer 3 but it confuses me that it pulls in angular 1.2.18 - especially because its stated that the ionic 1- beta 7 is for angular 1.2.17 …

would love some insight to this as well.

The ionic library already comes with angular resources. You just need to add it to the scripts section of your index page. See http://ccoenraets.github.io/ionic-tutorial/create-angular-service.html.

1 Like

@roberto - thx for your feedback and niece tutorial you have done!

i was @@gazing here: https://github.com/driftyco/ionic/blob/master/bower.json and because angular-resource was not listed here i assumed it was not part of ionic - still not clear to me where its pulled in within the ionic build process.

Just in case anyone else runs across this thread, angular-resource is not bundled with ionic.

  • ionic.bundle.js is a concatenation of:
  • ionic.js, angular.js, angular-animate.js,
  • angular-sanitize.js, angular-ui-router.js,
  • and ionic-angular.js
1 Like

See also: http://code.ionicframework.com where you can find some dependencies that aren’t bundled with Ionic, including angular-resource.js.