典型根模塊看起來像這樣角4根模塊「進口」和在角度4「進口」
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
在本文檔中,提到「在單根模塊的上面的例子,該應用程序模塊需要該瀏覽器模塊中的材料。要訪問該材料,請將其添加到@NgModule元數據導入中,如下所示。「 imports: [ BrowserModule ],
我的問題是:
什麼是「應用模塊需要的材料從該瀏覽器模塊中的」是什麼意思?
這個進口import { BrowserModule } from '@angular/platform-browser';
和這個imports: [ BrowserModule ],
有什麼區別?
有人能幫我理解在根模塊中使用imports
的目的嗎?
https://angular.io/guide/ngmodule-faq –
[angular2 - '導入'和'導出'如何在Angular2模塊中工作?](https://stackoverflow.com/questions/41281780/angular2-how-do-imports-and-exports-work-in-angular2-modules) – Milad
AppModule =應用程序模塊.... BrowserModule嵌入在此中。頂部的導入用於定位它的位置 – JGFMK