I'm getting an error where TypeScript is not recognizing the exported 'bootstrap' function from platform-browser-dynamic.
ERROR in [default] ../retain-app/src/main.ts:1:9
Module '"../retain-app/node_modules/@angular/platform-browser-dynamic/index"' has no exported member 'bootstrap'.
I imported bootstrap in main.ts like so:
import { bootstrap } from '@angular/platform-browser-dynamic';
This is the dependency in the package.json:
"@angular/platform-browser-dynamic": "^2.0.0",
Any help is appreciated!
Bootstrapping is done a little different with the final version, as opposed to some earlier RCs/betas. We no longer use bootstrap
. You should instead import the function platforBrowserDynamic
, and load the app module with that function
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './your.app.module.location';
platformBrowserDynamic().bootstrapModule(AppModule);
If you are going off an older tutorial that's not using modules, you may want to just check out the Angular Quickstart. At least the second half (after all the environment setup) where it shows how to use a module.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With