如何安装ngSanitize? [英] How to install ngSanitize?

查看:251
本文介绍了如何安装ngSanitize?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用ngSanitize,这样我可以注入HTML内容(外部)到我的应用程序。不过我被困在ngSanitize安装。如果我将其添加到我的应用程序模块将停止工作。我应该从什么地方下载呢? Angularjs文档不说什么了。

  VAR crmApp = angular.module('crmApp',[
  ngRoute',
  crmControllers',
  ui.bootstrap',
  ngSanitize',
]);


解决方案

。你想亭子。

  NPM安装-g亭子

转到您的项目的根并安装ngSanitize:

 凉亭安装角的sanitize --save

亭子安装下载适合你的脚本。包括中的JavaScript功能应用:

 <脚本的src =/ bower_components /角的sanitize /角sanitize.js>< / SCRIPT>

I'm trying to use ngSanitize so that I can inject html content ( external) into my app. However I got stuck at the ngSanitize installation. If I add it into my app module it stops working . Should I download this from somewhere ? Angularjs docs don't say anything.

var crmApp = angular.module('crmApp', [
  'ngRoute',
  'crmControllers',
  'ui.bootstrap',
  'ngSanitize',
]);

解决方案

Install bower. You want bower.

npm install -g bower

Go to your project root and install ngSanitize:

bower install angular-sanitize --save

bower install downloads the script for you. Include the JavaScript in your app:

<script src="/bower_components/angular-sanitize/angular-sanitize.js"></script>

这篇关于如何安装ngSanitize?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆