Angular2-dart in non SPA

Issue

I would like to use angular2-dart in non-spa as in

loading two components in angular2 non SPA

i.e. in any non-spa page (not just index.html), I would like to have something like

<body>
  <my-app-a>
    loading...
  </my-app-a>

  Static content 

  <my-app-b>
      loading ..
  </my-app-b>
 </body>

How can this be done using angular2-dart? This will allow to bootstrap arbitrary Angular2-dart component(s) in any non-spa page.

Solution

Just call bootstrap() twice in web/main.dart, like this:

void main() {
  bootstrap(AppComponent);
  bootstrap(App2Component);
}

I just tried it and it works fine.

Answered By – filiph

Answer Checked By – David Marino (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *