How does one access the Ember.Handlebars.Utils.escapeExpression
function using the new import syntax in Ember 2.16.x and above?
The following code snippet comes from the Writing Helpers section of the Ember docs. (FYI, there are a couple of unrelated errors in the original, which I have cleaned up in the code below.)
import { helper } from "@ember/component/helper";
import Handlebars from "handlebars";
import { htmlSafe } from "@ember/string";
export function makeBold(param /*, ...rest*/ ) {
let value = Handlebars.Utils.escapeExpression(param);
return htmlSafe(`<b>${value}</b>`);
}
export default helper(makeBold);
If I use the code above, I get the following error:
Could not find module 'handlebars' imported from 'ember-app/helpers/make-bold'
Aucun commentaire:
Enregistrer un commentaire