So I have angular from bower, now what?

146 views Asked by At

I just started a new project, these are the exact steps I have taken.

  1. foundation new project_name --libsass
  2. bower install angular --dev
  3. grunt build

All good, the sass files are compiling, angular is setup under bower_components inside the angular folder, but wait.....

Now I need to add Angular's ng-resource module. I figure I can do a few things here. Let's forget that there is anything better than ngResource (like Restangular) and assume that I may want to install ngResource or any other angular module.

Do I need to add them each individually from bower, because I can't find a bower package for ngResource like I could angular. Or can I just throw the angular modules inside the /bower_components/angular folder and update the bower.json with the dependency for that module?

Is that the right way?

If so, how would my dependency section of the /bower_components/angular/bower.json look like?

{
  "name": "angular",
  "version": "1.4.0",
  "main": "./angular.js",
  "ignore": [],
  "dependencies": {
    //what goes here?
  }
}

also do I just manually add the modules in and update the bower.json or is there some other better way of doing this?

I'm sorry I am new to bower and it seems very unclear.

1

There are 1 answers

8
Abdel Raoof Olakara On BEST ANSWER

There is a better way to do it! You could make use of --save option of bower to have the dependencies.

For example you could have done:

bower install angular --dev --save

So that, the bower.json file is automatically updated by the bower and you don't have to touch it!

Quoting from the docs, here are the options that you can use:

-S, --save: Save installed packages into the project’s bower.json dependencies

-D, --save-dev: Save installed packages into the project’s bower.json devDependencies