Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Angular2 as a non-SPA?

Tags:

angular

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.

like image 952
Radical_Activity Avatar asked Jun 10 '16 12:06

Radical_Activity


1 Answers

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

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

bootstrap(ContactComponent);
like image 124
null canvas Avatar answered Oct 23 '22 05:10

null canvas