AngularJS: How to nest applications within an angular app

后端 未结 5 1940
梦毁少年i
梦毁少年i 2020-12-02 09:50

i\'ve been working on a project that is more like a framework, and has several apps / modules you can install. See it like a basic appstore or google.play store. It\'s sort

5条回答
  •  栀梦
    栀梦 (楼主)
    2020-12-02 10:24

    Similar to UnicodeSnowman's answer above, another potential solution that appears to be working for my needs (I built a live Angular editor on a documentation site) is to manually handle the bootstrap process by having a

    that is separate from the main
    .

    This article was very helpful to get it working correctly.

    General Process

    • Create your main app (I chose to manually bootstrap, but you may be able to use ng-app for this part)
    • Create a new HTML structure/app (in my case the demo app):
    • Append it to the demos div with a custom id: someCoolDemoContainer
    • Boostrap the newly created app
    • Move it back into the original app (for layout/positioning purposes)

    Code Example (not tested; just shows basic process)

    Demo

    Click the button below to checkout the cool demo!

提交回复
热议问题