是否可以将Angular2 CLI 4.0在网站内嵌到iframe中,以便预览Angular2组件?感谢回答这个问题。
是否可以将Angular2 CLI 4.0在网站内嵌到iframe中,以便预览Angular2组件?感谢回答这个问题。
您可以运行 Angular 应用并将其加载到 iframe 中。在您的应用程序中,您应该创建一个路由,只有一个组件是可见的。然后,您可以将其加载到其他网站的 iframe 中。
例如:您的组件将可用于 http://localhost:4200/components/card
然后,在您的网站上,您可以像这样加载它:
<iframe src="http://localhost:4200/components/card></iframe>
http://localhost:4200
,这是使用 ng serve
运行应用程序时的默认URL。<iframe src='http://localhost:4200'>
,Angular应用程序将加载在您的网站内部。