Angular 2 iframe on site

Is it possible to run angular2 cli 4.0 in an iframe on a website to have a preview of angular2 components? I would be grateful for the answer to this question.

+5
source share
3 answers

You can run the angular application and load it into an iframe. In your application, you must create a route in which only one component will be displayed. You can then upload it to an iframe on another website.

Example: your component will be available at http://localhost:4200/components/card

and then on your website you can download it like this: <iframe src="http://localhost:4200/components/card></iframe>

+4
source

Lets say the angular application is hosted at http://localhost:4200 , which is the default url when starting the application with ng serve

Just add <iframe src='http://localhost:4200'> to your web application and the angular application will be loaded inside your website.

+1
source

How to do routing from here inside an iframe to load another component from that component?

0
source

Source: https://habr.com/ru/post/1267218/


All Articles