I have a simple question: in a simple Angular component, could we change dynamically the template retrieved by a http call for example:
import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
/**
* Les liens link permettent de passer d'une page à l'autre.
*/
@Component({
selector: 'mycomponent',
template: '<strong>Loading…</strong>'
})
export class MyComponent implements OnInit {
//#region PROPRIÉTÉS
private moHttp : HttpClient
//#endregion
//#region CONSTRUCTEUR
constructor(poHttp: HttpClient){
this.moHttp = poHttp;
}
public ngOnInit(): void {
this.moHttp.get('https://myapiUrl').subscribe(poData:any => {
// here poData is HTML string, and I want to set it instead of the "<strong>Loading…</strong>"
});
}
}
//#endregion
Thank you in advance