1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Transform an Angular Component into a native Custom Element

    angularAngular
    ^7.0.0

    Dynamic components aren’t always that easy, especially if you’d like to retrieve and instantiate them as part of an HTML coming from the server API. In this lesson we’re going to transform an Angular component into an Angular Element and dynamically insert it into the HTML by using the innerHTML property of a DOM element.

    Note, if you get an error "Failed to construct 'HTMLElement': Please use the 'new' operator..", make sure to install the @webcomponents/webcomponentsjs polyfill and add the following '@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js'; at the end of polyfills.ts. I discuss this as well in the lesson.

    Also check out this GitHub issue for more infos.