[Vuejs]-TypeError: this.decodeHtml is not a function

0👍

You have a problem with scope. On your html function the this variable is a Window object and not a Vue object as it should be.

The workaround you can do is instead of calling the decodeHtml function you implement it in your filter. Like this:

filters: {
  html: (html) => {
    var txt = document.createElement("textarea");
    txt.innerHTML = html;
    return txt.value;
  }
}

Leave a comment