Hi Scott,
Your use-case is quite common. The easiest way is to create a component to
show your loaded code.
I Added a small module to my samples repo
<https://github.com/SanderElias/Samples/blob/master/src/app/html-load/htmlload/htmlload.component.ts>.
You can check that out.
the gist is this:
ngOnInit() {
/** I don't need to unsubscribe, because htmlLoad completes */
this.html.load('Some url provided').subscribe(html => {
/**
* setting innerHTML doesn't "run" scripts,
* instead create a document fragment
*/
const frag = document.createRange().createContextualFragment(html);
/** erase old content */
this.elm.innerHTML = '';
/** add the new 'html' to the page */
this.elm.appendChild(frag);
});
}
I hope this helps you.
Regards
Sander
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.