ember.js - How to use ES2015 Template strings in an Ember helper -
ember > 2.0 + ember suave telling me:
"requiretemplatestringsforconcatenation: using manual concatenation strings not allowed @ helpers/svg-icon.js"
import ember 'ember'; export function svgicon(iconname) { return ember.string.htmlsafe("<svg class='icon-x'><use xlink:href='#icon-" + iconname + "'></use></svg>"); } export default ember.helper.helper(svgicon);
i've come meetup ember.string.fmt discussed , sounded promising ~ has been deprecated , suggests use es2015 template strings.
reading here: http://babeljs.io/docs/learn-es2015/
i unclear how 'manual' concatenation works - problem - , well, whole thing.
return ember.string.htmlsafe("<svg class='icon-x'><use xlink:href='#icon-${iconname}'></use></svg>");
?
implementation , reasoning happily accepted.
Comments
Post a Comment