I have a function witch gets html content from file as a string. After that I made it as a html object. I can clearly see it in my console that it works. How to pass it from a service to a div element ?
nav.service.ts :
html: string;
public getZipFileContent(urlPath:string, pathInZip:string, ) {
getFileContentFromRemoteZip(urlPath, pathInZip, (content) => {
console.log(content);
let html = content;
let htmlObject = document.createElement('div');
htmlObject.innerHTML = html;
console.log(htmlObject);
this.html = html; // it's a string
this.html = htmlObject // error : can't asign string as HTMLdivElement
});
}
}
What I get now by adding {{navSrv.html}} in my component :
What I want to get :
Hello
Console.log from : console.log(htmlObject);
How to get htmlObject and use it as a variable ?