angularjsnpmbowerangularjs-module

What is the difference between using bower and npm for adding angular module?


I am trying to add a new angular module. https://github.com/angular/bower-angular-animate

I noticed that there are 2 ways to add an angular module. One is using bower. The other is using npm.

$ npm install angular-animate
//add dependency
angular.module('myApp', [require('angular-animate')]);

$ bower install angular-animate
<script src="/bower_components/angular-animate/angular-animate.js"></script>
angular.module('myApp', ['ngAnimate']);

What is the difference between the 2 methods? What are the pros and cons of each method?


Solution

  • bower is load the modules in browser end this bower modules will use only in front end you cant use it in backend. npm is load the modules in backend as well you can us it in back end and front end by using require or import