BrowserModule和platformBrowserDynamic有什么区别? [英] What's the difference between BrowserModule and platformBrowserDynamic?

查看:523
本文介绍了BrowserModule和platformBrowserDynamic有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这两个模块的目的是什么?

What are the purposes of these two modules?

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

推荐答案

platformBrowserDynamic是用于引导Angular应用程序的函数.

platformBrowserDynamic is a function used to bootstrap an Angular application.

CommonModule是一个模块,提供通常在Angular2应用程序(如ngIf)中使用的各种服务和指令. CommonModule与平台无关.

CommonModule is a module that provides all kinds of services and directives one usually wants to use in an Angular2 application like ngIf. CommonModule is platform-independent.

BrowserModule导出CommonModule并提供一些特定于浏览器平台的服务(与ServerModuleServiceWorkerModule相反).

BrowserModule exports CommonModule and provides a few services specific to the browser platform (in contrary to ServerModule or ServiceWorkerModule).

BrowserModule仅应在AppModule中导入,CommonModule可以在任何地方导入.

BrowserModule should only be imported in AppModule, CommonModule can be imported everywhere.

这篇关于BrowserModule和platformBrowserDynamic有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆