How to convert string to html


#1

i have store HTml code in variable when i fetch it in .html file it treat it as a string instead of html code

 for(i = 1;this.i<this.start;this.i++){
      if(this.i == 1 && this.start!==1){
        this.td[i]= '<td></td>';
      }else{
        this.td[i]= '<td></td>';
      }
      
    }

#2

Angular does not want you to do this. All HTML belongs in templates, not in controller code.


#3

is there any way to do


#4

Hello,
with ionic 2+ you can use angulars ngif, ngfor etc to implement such things into your template. What @rapropos would say you is not that there is not possiblity to do what you want, but .ts is the wrong place for them.

See here https://codecraft.tv/courses/angular/built-in-directives/ngfor/ and following.

For better help, you should explain more what you want achieve or how your template should look.

Best regards, anna-liebt