Last active
June 10, 2019 13:16
-
-
Save amk221/8d3d59ef47819ddfb68cf606cca3c53e to your computer and use it in GitHub Desktop.
ember style attribute helpers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import { helper } from '@ember/component/helper'; | |
const { escapeExpression } = Ember.Handlebars.Utils; | |
/** | |
* This helper escapes a value | |
* | |
* Example: | |
* {{escape "<b>Hi!</b>"}} | |
* | |
* ...results in '<Hi!>' | |
* | |
*/ | |
export default helper(function(args) { | |
return escapeExpression(...args); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { helper } from '@ember/component/helper'; | |
import { htmlSafe } from '@ember/string'; | |
/** | |
* This helper is a replacement for triple curlies. | |
* | |
* Example: | |
* {{html-safe "<b>foo</b>"}} | |
* | |
*/ | |
export default helper(function(args) { | |
return htmlSafe(...args); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment