user91579631 user91579631 - 8 months ago 89
AngularJS Question

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

I am trying to add a new angular module.

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?


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