Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to develop Embeddable Widgets using Angular 2 for 3rd party sites

Tags:

angular

widget

I'm not sure if this is possible in Angular 2, but,

I want to know if there is any way/approach/support for developing embeddable widgets which can be integrated into other websites that perform certain functionality.

For example, a small piece of source code that generates a button on the 3rd party website. Clicking on this button generates some popup windows performing some actions contacting our web server.

Please share your thoughts on this.

like image 369
Sam Avatar asked Mar 09 '17 06:03

Sam


People also ask

What are embeddable widgets?

An embeddable widget is any widget that could be embedded right inside your webpage in a way that it looks like an integral part of the website.

How do I embed a Web widget?

If you want to add the widget to your website, go to the web page where you want to add the widget, then paste the code before the closing HTML </body> tag. Add the code to every web page where you want the widget to appear. Make sure your firewall is configured to allow the Web Widget (Classic) to appear.


1 Answers

Have you heard of Angular Elements? It was introduced in Angular 6. The scenario that you're referring to sounds like a perfect use case for Angular Elements.

Angular elements are Angular components packaged as custom elements, a web standard for defining new HTML elements in a framework-agnostic way.

So just think of them as self-contained widgets, that will play quite nicely with any of your web apps built on any framework/library.

Have a look at this enlightening NGCONF Talk by Rob Wormald on Angular Elements. You can find several tutorials on creating an Angular Element. Here's another one by Jeff Delaney from AngularFirebase.

Angular's Official Website also has a very nice and easy to understand example that you can have a look at here.

Hope this helps.

like image 136
SiddAjmera Avatar answered Oct 21 '22 16:10

SiddAjmera