Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bootstrap vs bootstrapModule

Tags:

angular

This article describes the bootstrap function used to bootstrap angular app:

import {bootstrap} from 'angular2/platform/browser';
import {AppComponent} from './app.component';

bootstrap(AppComponent)
    .then(success => console.log('Bootstrap successfully!'))
    .catch(err => console.log(err));

However, I'm bootstrapping the app like this:

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';    
import { AppModule } from './app.module';

platformBrowserDynamic().bootstrapModule(AppModule);

What's the difference?

like image 921
Max Koretskyi Avatar asked Aug 31 '25 02:08

Max Koretskyi


1 Answers

Since 2.0.0-rc.5 (2016-08-09) there is no longer the bootstrap function.

You need to use platformBrowserDynamic().bootstrapModule instead.

More about it you can read at changelog page

https://github.com/angular/angular/blob/master/CHANGELOG.md#200-rc5-2016-08-09

like image 106
yurzui Avatar answered Sep 03 '25 04:09

yurzui