I'm getting used to Angular 2 but I have a few questions concerning the app.module.ts file.
- Why do I have to do the imports in this file since I will be doing the inputs again in the app.components.ts file.
For example: I import my custom pipe and then again I have to import it in my app.components.ts file
import { FirstPipePipe } from './first-pipe.pipe';
@NgModule({
declarations: [
AppComponent,
SecondComponent,
ThirdComponent,
FirstComponent,
FirstPipePipe
],
imports: [
BrowserModule, RouterModule.forRoot(appRoutes), HttpModule
],
providers: [FetchDataService],
bootstrap: [AppComponent] })
Then I have the
imports: [
BrowserModule, RouterModule.forRoot(appRoutes), HttpModule
],
Why do I import some classes and others not?
Why are the providers here, since again, they appear in the app.component.ts
providers: [FetchDataService]
Basically, I have to rewrite everything in my app.component.ts file.
What is the purpose of the app.module.ts?