Why we using bootstrap in angular 2 and above

Why we using bootstrap in angular 2 and above

No we have defined our root module called AppModule we need to bootstrap the application using bootstrap.


import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

.

.

 platformBrowserDynamic().bootstrapModule(AppModule);

Why the Angular 4 does not do this for us like it did in Angular 1

In Angular bootstrapping is a platform specific.

Angular 1 assumed that Angular would only ever be run in a browser, Angular 4 makes no such assumption. We could be writing Angular code for a mobile device using a solution like Ionic. We could be loading up Angular on a node server so we can render HTML for web crawlers that don’t run JavaScript.

Angular 4 is not limited to only working in the browser which is why we need to tell Angular exactly how we want it to bootstrap itself, in our case we are running in the browser so we use the platformBrowserDynamic function to bootstrap our application.

0 Comments

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed

>