Presented By Tom Acree
Columbus AngularJS Meetup Nov, 2016
> npm install --save lodash
> npm install --save @types/lodash
# No need to update typings.d.ts, Typescript can read types from node_modules
# now you can do the following in your module files
// import lodash library
import * as _ from "lodash";
# See tsconfig.json typeRoots setting
interface NgModule {
imports : Array<Type<any>|ModuleWithProviders|any[]>
declarations : Array<Type<any>|any[]>
bootstrap : Array<Type<any>|any[]>
providers : Provider[]
exports : Array<Type<any>|any[]>
entryComponents : Array<Type<any>|any[]>
schemas : Array<SchemaMetadata|any[]>
id : string
}
Decorator accepts a single object with properties that describe the module.
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
@NgModule({
imports: [
BrowserModule,
FormsModule
],
declarations: [
AppComponent
],
bootstrap: [AppComponent],
providers: []
})
export class AppModule { }
@NgModule({
imports: [
BrowserModule,
FormsModule
],
...
})
export class AppModule { }
@NgModule({
...
declarations: [
AppComponent
],
...
})
export class AppModule { }
@NgModule({
...
bootstrap: [AppComponent],
...
})
export class AppModule { }
@NgModule({
...
providers: [LoginService],
...
})
export class AppModule { }