1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Using Angular's Custom Elements

Discussão em 'Angular' iniciado por hello-there, Julho 18, 2025.

  1. hello-there

    hello-there Guest

    I have to build a web component to inject inside a legacy code project; I tried to follow the official documentation to do so using angular (https://v19.angular.dev/guide/elements) but I feel like is a bit incomplete: for example there is nothing about how do produce a js file to then refer in the html of the target project to be able to use the custom html tag.

    I searched extensively for guides or more about the topic but nothing pops out on the Internet, at least not for the newer versions of Angular (newest stuff I found was 2 year old).

    I followed the official guide 'till the end and tried to ng build and use the main.js and polyfill.js inside of an html file to reference the custom html tag created in Angular but I get the following error that is not so explanatory.

    [​IMG]

    Anyone out there building web components in angular that's facing my same troubles?

    This is my app.component.ts: [​IMG]

    This is my notifications-center.ts and html; [​IMG]

    [​IMG]

    As you can tell the component is default just because I wanted to test stuff before actually starting the developing.

    This is the html file where I'm trying to use the web-component: [​IMG]

    Continue reading...

Compartilhe esta Página