Using php REST, I am getting html in json from php server.
I used to simply use innerhtml
to display the html in angular.
However, I need to add the html component to the angular component instead
main.ts
import { my_component } from './my_component';
@Component({
selector: 'page-main_page',
templateUrl: 'main_page.html'
})
export class main_page {
data: any;
constructor(public mine: my_component ){
};
ngOnInit(){
this.getDynamicREST().then((res)=>{
//where res is "<div class="test">Test</div>"
//????
})
};
}
my_component.ts
import { Component } from '@angular/core';
@Component({
selector: 'my_component ',
template: '????' // HTML json goes here
})
export class my_component {
data: any;
}
How would I achieve this so that I can fetch angular components dynamically and add them to the my_component.ts
template?
Any help will be much appreciated.
Thank you.