Standalone Components with Angular Elements to generate Web Components

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 ธ.ค. 2024

ความคิดเห็น • 39

  • @igorparampam5984
    @igorparampam5984 4 หลายเดือนก่อน

    Wonderful video. Thank you very much

  • @sandeshmargaj3446
    @sandeshmargaj3446 10 หลายเดือนก่อน +2

    Can you please share how we can do the same in Angular 17 using standalone components

    • @DevBySeb
      @DevBySeb  10 หลายเดือนก่อน

      There is a comment here outlining that answer mate 😁

  • @lahirumadushan2492
    @lahirumadushan2492 ปีที่แล้ว +1

    It was very helpful. thanks. subscribed !

    • @DevBySeb
      @DevBySeb  ปีที่แล้ว

      Thank you for watching mate 🙏🙏

  • @marc_gutii
    @marc_gutii ปีที่แล้ว +1

    Very useful, thanks :)

    • @DevBySeb
      @DevBySeb  ปีที่แล้ว

      Thank you and thanks for watching mate 🙏🏼

  • @Piri8
    @Piri8 ปีที่แล้ว +1

    How would you go about creating multiple elements in the same angular project? Lets say you are migrating an old web application so you have to create one angular element at the time but the goal is that eventually you will use the angular app as a whole.

    • @DevBySeb
      @DevBySeb  ปีที่แล้ว +1

      That's a good question mate. Usually, the answer would differ from project to project due to different business cases. What we've (in the teams I have been a part of/leading) done before is that we for instance extracted the core components like Header/Footer to Web components, and more simple components like buttons, chips, etc.
      What you want to avoid is spending too much time to ensure that the web components work :)

  • @MaddesMat
    @MaddesMat ปีที่แล้ว +1

    Great work👏

    • @DevBySeb
      @DevBySeb  ปีที่แล้ว

      🙏🙏🙏

  • @javidcarlos
    @javidcarlos 6 หลายเดือนก่อน +1

    How to load assets folder images of web app in host application.

    • @DevBySeb
      @DevBySeb  6 หลายเดือนก่อน

      Good question mate. If the target Host application is written in Angular, you would have to include it under assets in angular.json-file.

  • @sw3tyy
    @sw3tyy ปีที่แล้ว +1

    Is there a way to make Debugging possible with this component?

    • @DevBySeb
      @DevBySeb  ปีที่แล้ว

      Excellent question mate. It's quite difficult to set up debugging for this. What you could do is build without a prettified version for instance with sourceMap: true :)

  • @MarkusThiel
    @MarkusThiel ปีที่แล้ว +1

    So the idea here is to create a application for each component you want to use a custom element in eg. index-test.html ?

    • @DevBySeb
      @DevBySeb  ปีที่แล้ว

      Good question mate. The idea is that you create a complete component library in Angular, which then could be utilized in any framework. In this video, I use it in index-test.html to simulate how it could be used with vanilla.js. The index-test file could utilize multiple components from the generated code :)

    • @MarkusThiel
      @MarkusThiel ปีที่แล้ว

      @@DevBySeb hmmm.. but so the app is create just to be able to generate files needed?

    • @DevBySeb
      @DevBySeb  ปีที่แล้ว

      ​@@MarkusThiel Not sure I understood you correctly mate.
      But let's say, you got a couple of projects you want to work with. Thus, the main application shall be in Angular, meanwhile, the other applications might be in React, Vue, or even in Vanilla.js.
      You can generate a chunk of that Angular application if created as a component library as standalone components together with Angular Elements. This will make it possible for your team to get the same "look" and feel cross different applications. And since we're using Angular within Vanilla.js, there are a couple of things we need to set up which doesn't come out of the box, for instance, the event emitter.
      Hope that was clear mate. And once again, thanks for your interest! :)

    • @dawidkostka1346
      @dawidkostka1346 ปีที่แล้ว

      @MarkusThiel NX build system is what you're looking for

    • @MarkusThiel
      @MarkusThiel ปีที่แล้ว

      @@dawidkostka1346 I have been using Nx for the past 3-4 years.. how does it solve the question?

  • @luxiansheng2268
    @luxiansheng2268 9 หลายเดือนก่อน +1

    how were the styles handled?

    • @DevBySeb
      @DevBySeb  9 หลายเดือนก่อน

      In a similar way it would be done as if its a regular Angular component mate 😁

    • @luxiansheng2268
      @luxiansheng2268 9 หลายเดือนก่อน +1

      Thanks for your reply. You know there'll be another style file for a regular Angular app. But I didn't see you handling, contacting or importing the style file. That's why I'm asking.@@DevBySeb

  • @HarshavardhanKanoj
    @HarshavardhanKanoj 2 หลายเดือนก่อน

    Routing is not working in angular 18 ,after following this step.

  • @bbbjames1
    @bbbjames1 11 หลายเดือนก่อน

    how does this work with angular 17? Theres no runtime.js file that gets generated in the build. Does the runtime.js happen in main.js now with angular 17? Is the bootstrap process the same?

    • @bbbjames1
      @bbbjames1 11 หลายเดือนก่อน +1

      Figured it out and sharing here in case anyone else has this question. You just need to cat the polyfill & main js files. Another thing to note is that since Angular v17 uses esbuild, you have to run the test index file on a server to see the custom element otherwise you'll get a CORS error in the client (it'll say failed to export from lib but its really a cors error).

    • @DevBySeb
      @DevBySeb  11 หลายเดือนก่อน

      Sorry for the late response mate and thank you for sharing with us mate! Much appreciated! 🙏🏼

    • @hasan11911
      @hasan11911 10 หลายเดือนก่อน

      @@bbbjames1 Hi, thanks for the tip. I tried this but it is not working. Followed all steps you mentioned.

    • @sandeshmargaj3446
      @sandeshmargaj3446 10 หลายเดือนก่อน

      @@bbbjames1 Can you share your code with Angular 17. I am getting error when I render bundled js

    • @alnes204
      @alnes204 9 หลายเดือนก่อน

      "Uncaught SyntaxError: Unexpected token 'export' (at component-lib.js:9:144957)" i thing you mean this error ?
      @@bbbjames1

  • @MarektAtJJ
    @MarektAtJJ 5 หลายเดือนก่อน +1

    Not working for angular 18

    • @DevBySeb
      @DevBySeb  5 หลายเดือนก่อน

      @@MarektAtJJ thanks for the feedback mate. I might try it out and make a video for it 😁

    • @MarektAtJJ
      @MarektAtJJ 5 หลายเดือนก่อน

      @@DevBySeb Yes it's will works by doing soke workaround but as soon as I include more features I ended up with some errors who are kind of wearied.

  • @shriramjadhav
    @shriramjadhav ปีที่แล้ว +1

    Angular component animation does not work with Angular Elements!!!

    • @DevBySeb
      @DevBySeb  ปีที่แล้ว +1

      I haven't tested that out to be honest mate. Thanks for that input - I would then recommend using CSS animations if possible. :)

    • @shriramjadhav
      @shriramjadhav ปีที่แล้ว +1

      @@DevBySeb Thank you.