Is it possible to nest Angular2 applications

前端 未结 1 722
情深已故
情深已故 2021-01-22 15:13

Suppose I want to build an Angular2 Application that can be inserted into third-party pages. The third-party page might already use Angular2 (possible in a different version). W

相关标签:
1条回答
  • 2021-01-22 15:36

    The answer is yes, Angular is capable of bootstrapping multiple applications. It is designed for that, here are several hints:

    In this line of code we can see multiple root components, each root component is an app hence multiple apps.

    In this line of code we can see there are multiple root change detectors (hence forEach). A component has 1 change detector, this is true for the root component as well (MyApp), so multiple change detectors hint multiple root components, i.e: multiple apps.

    I created a plunker sample to show that it works

    https://embed.plnkr.co/37vJiq/
    
    0 讨论(0)
提交回复
热议问题