@angular/platform-browser vs. @angular/platform-browser-dynamic

user2227400 picture user2227400 · Jun 23, 2016 · Viewed 27.7k times · Source

In the newer examples (seeds, angular.io,..) there is an another import for the bootstrapping process: @angular/platform-browser-dynamic.

Could someone explain, what are the differences between it and @angular/platform-browser?

There is no information on the official angular.io website yet.

Answer

Günter Zöchbauer picture Günter Zöchbauer · Jun 23, 2016
  • platform-browser contains code shared for browser execution (DOM thread, WebWorker)
  • platform-browser-dynamic contains the client side code that processes templates (bindings, components, ...) and reflective dependency injection

When the offline template compiler is used, platform-browser-dynamic isn't necessary anymore because all reflective access and metadata are converted to generated code.

If you still want to dynamically generate components like shown in https://stackoverflow.com/a/36017067/217408 then you need the dynamic stuff.