【问题标题】:What is the difference between using bower and npm for adding angular module?使用 bower 和 npm 添加角度模块有什么区别?
【发布时间】:2016-11-04 15:08:27
【问题描述】:

我正在尝试添加一个新的角度模块。 https://github.com/angular/bower-angular-animate

我注意到有两种方法可以添加角度模块。一种是使用凉亭。另一个是使用 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']);

这两种方法有什么区别?每种方法的优缺点是什么?

【问题讨论】:

标签: angularjs npm bower angular-module


【解决方案1】:

bower 是在浏览器端加载模块,这个 bower 模块只会在前端使用,你不能在后端使用它。 npm 也在后端加载模块,你可以使用 require 或 import 在后端和前端使用它

【讨论】:

    猜你喜欢
    • 2015-11-12
    • 2017-08-14
    • 1970-01-01
    • 2017-11-13
    • 2014-05-20
    • 2017-02-16
    • 2011-04-10
    • 2013-01-11
    相关资源
    最近更新 更多