Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install ngSanitize?

Tags:

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', ]); 
like image 657
hey Avatar asked Jul 27 '14 22:07

hey


2 Answers

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> 
like image 124
Andy Gaskell Avatar answered Oct 19 '22 20:10

Andy Gaskell


If you want to use CDN resources without download go to https://code.angularjs.org/ and click on version you want .Will find all the various resources available there and then you can copy location straight into script tag:

<script src="//code.angularjs.org/1.2.20/angular-sanitize.min.js"></script> 
like image 39
charlietfl Avatar answered Oct 19 '22 22:10

charlietfl