I want to add a span with different icons based on a flag, with the onclick event that call an inside function defined in component ts.
testfunc(){
 console.log("it works")
}
flagToIcon(flag: boolean) {
    switch (flag) {
      case true:
       return `<span 
        class="isp-font-2x isp-font-lock cursor-pointer cursor-pointer" ${(onclick)}=${this.testfunc()}></span>`;
        
      case false:
        return `<span "
        class="isp-font-2x isp-font-edit-pencil-n cursor-pointer" ${(onclick)}=${this.testfunc()}></span>`;
    }
  }
I'm able to differentiate the cases and the html is returned, however the span tag is rendered without the onclick function. What am I doing wrong?
 
    