Radical_Activity Radical_Activity - 5 months ago 309
AngularJS Question

How to use Angular2 as a non-SPA?

I have just started out with Angular2 and found out that all tutorials that can be found on the web only explains how to setup Angular2 for Single Page Apps (SPA).

However for the homepage of my site I still want to use PHP and just use Angular2 on a few places like Login/Signup/Contact, etc.

How is that possible to initialize the Contact Component on the contact page, Login Component on the login page, etc?

I don't want all of them to load at once, just a simple component that handles the logging in, signing up, etc functions.

I beleive something need to be done on the Bootstrapping part, but what exactly?

EDIT: I also might want to use the Login + Signup componenents on one page.


I think you could bootstrap whatever component you need on that page

import {bootstrap}    from '@angular/platform-browser-dynamic';
import {ContactComponent} from './contact.component';