How to use string retrieved from back-end as template in Angular2?

前端 未结 2 1646
生来不讨喜
生来不讨喜 2021-01-29 10:24

In an Angular2 app, I\'d like to use ajax to retrieve a html tag string from back-end and use it as template in Angular2.

// The str I get from server by ajax i         


        
2条回答
  •  故里飘歌
    2021-01-29 10:36

    I think you can send this particular html as a template in a component like this

    angular.module('MenuApp')
    .component('itemset1', {
    templateUrl: '',
    });
    

提交回复
热议问题