mercredi 6 septembre 2017

Helper not recognizing the `htmlSafe` stuff

I am trying to retun a value with space added through helper. but I am not getting the result.

here is my code :

import Ember from 'ember';

export function cardNoDisplay(params/*, hash*/) {
  var paramStr = params.toString(); 
  var updatedParams = paramStr.substring(paramStr.length-4);
  var reformat = paramStr.replace(/(\d{4})/g, function(match){
    return match + Ember.String.htmlSafe("<span>++</span>");
  });
  return reformat;
}

export default Ember.Helper.helper(cardNoDisplay);

But the result comes like :

<span>3230<span>++</span>4211<span>++</span>5712<span>++</span>8203<span>++</span></span>

What is wrong with my code here?

thanks in advance.

here is the HBS file :

<span class="cs2i-purchase-card-font">
                
                <span></span>
              </span>




Aucun commentaire:

Enregistrer un commentaire