What's the difference between BrowserModule and platformBrowserDynamic?

前端 未结 3 2072
庸人自扰
庸人自扰 2021-02-06 10:05

What are the purposes of these two modules?

import { BrowserModule } from \'@angular/platform-browser\';
import { platformBrowserDynamic } from \'@angular/platfo         


        
3条回答
  •  粉色の甜心
    2021-02-06 10:55

    Angular Modules help organize an application into cohesive blocks of functionality.

    Root module needs to import the BrowserModule from @angular/platform-browser to the imports array.

    BrowserModule registers critical application service providers. It also includes common directives like NgIf and NgFor which become immediately visible and usable in any of this modules component templates.

    QuickStart application is a web application that runs in a browser which involves this Browser Module

    PlatformBrowserDynamic - contains the client side code that processes templates

    See these links, this might help also: @angular/platform-browser vs. @angular/platform-browser-dynamic

    and

    https://angular.io/docs/ts/latest/guide/ngmodule.html

提交回复
热议问题