title: Angular typescript how to convert string to html object and pass it to variable
body: <p>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 ?</p>
  
  <p><strong>nav.service.ts</strong> :</p>
  
  <pre><code>html: string;
        public  getZipFileContent(urlPath:string, pathInZip:string, ) {
          getFileContentFromRemoteZip(urlPath, pathInZip, (content) =&gt; {
            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
          });
        }
      }
  </code></pre>
  
  <p>What I get now by adding <strong>{{navSrv.html}}</strong> in my component : </p>
  
  <p><a href="https://i.stack.imgur.com/MAo5M.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MAo5M.png" alt="enter image description here"></a></p>
  
  <p>What I want to get : </p>
  
  <h1>Hello</h1>
  
  <p>Console.log from : console.log(htmlObject); </p>
  
  <p><a href="https://i.stack.imgur.com/NF1NW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NF1NW.png" alt="enter image description here"></a></p>
  
  <p><strong>How to get htmlObject and use it as a variable ?</strong></p>