Skip to content

Instantly share code, notes, and snippets.

@amk221
Last active February 9, 2016 17:45
Show Gist options
  • Save amk221/1bea7a783f76413e2e47 to your computer and use it in GitHub Desktop.
Save amk221/1bea7a783f76413e2e47 to your computer and use it in GitHub Desktop.
Ember escape helper
import Ember from 'ember';
import { helper } from 'ember-helper';
import { htmlSafe } from 'ember-string';
const { escapeExpression } = Ember.Handlebars.Utils;
/**
* This helper escapes a value, useful for building styles
*
* @example
* <div style={{escape (concat 'color:' ugcColour)}}></div>
*
*/
export default helper(function(args = []) {
return htmlSafe(escapeExpression(args[0]));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment