How to translate HTML string to real HTML element by ng-for in Angular 2?

前端 未结 5 1682
走了就别回头了
走了就别回头了 2020-12-01 16:20

As I know, in angular 1.x I can use $sce service to meet my requirment like this

myApp.filter(\'trustAsHTML\', [\'$sce\', function($sce){
  return function(t         


        
5条回答
  •  無奈伤痛
    2020-12-01 16:40

    I got Same Problem buy I Request the decode HTML from Backend and them you can inject html to your page

    // YOUR TS
    @Component({
      selector: 'page',
      templateUrl: 'page.html'
    })
    export class Page {
      inject:any;
      constructor( ) { }
    
      ionViewDidLoad() {
        this.inject='your HTML code'
    
      }
    
    }
    // YOU HTML PAGE
    
    

提交回复
热议问题