Sanitize user provided HTML in your Ember CLI app
npm install ember-sanitizeAn Ember CLI addon to sanitize user provided content using sanitize.js.
Install this addon via npm:
```
npm install --save-dev ember-sanitize
Then run the generator to install sanitize.js:
``
ember generate ember-sanitize
Simply use the sanitize-html helper in your template:
`handlebars`
{{sanitize-html someValue}}
This will use the most restrictive sanititizer config by default, which will strip all HTML.
To use your own sanitizer configuration, add a file to /app/sanitizers/ which exports an object
conforming to sanitizer's configuration options.
For example:
`js`
// /app/sanitizers/strict.js
export default {
elements: ['b', 'em', 'i', 'strong', 'u']
};
You can then use this configuration by passing it in as the second argument to the helper:
`handlebars`
{{sanitize-html someValue "strict"}}
* git clone this repositorynpm install
* bower install
*
* ember server
* Visit your app at http://localhost:4200.
* ember testember test --server`
*