# Angular 5+ for Components
基于Angular5+、TypeScript封装的小组件

## [预览](https://xiongyayun428.github.io/angular-xyy/ "实例预览")

## Setup

Download the library with npm
```
npm install --save angular-xyy
```

### HttpModule
Import the `HttpModule` in to your `AppModule`

Default:
```ts
@NgModule({
    imports: [ HttpModule ],
    declarations: [ AppComponent ],
    bootstrap: [ AppComponent ]
})
export class AppModule { }
```

User defined:
```ts
@NgModule({
    imports: [ HttpModule.settings({ Transaction }) ],
    declarations: [ AppComponent ],
    bootstrap: [ AppComponent ]
})
export class AppModule { }
```

Using

```ts
constructor(private http: HttpService) { }

functionName() {
    this.http.post(...);
}
```

### NotificationsModule

Import the `NotificationsModule` in to your `AppModule`
```ts
@NgModule({
    imports: [ NotificationsModule.forRoot() ],
    declarations: [ AppComponent ],
    bootstrap: [ AppComponent ]
})
export class AppModule { }
```

Using

```ts
constructor(private notifications: NotificationsService) { }

functionName() {
    this.notifications.success('title', 'content');
    ...
}
```

### ConfirmDialogModule

Import the `ConfirmDialogModule` in to your `AppModule`
```ts
@NgModule({
    imports: [ ConfirmDialogModule.forRoot() ],
    declarations: [ AppComponent ],
    bootstrap: [ AppComponent ]
})
export class AppModule { }
```

Using

```ts
constructor(private confirmation: ConfirmationService) { }

functionName() {
    this.confirmation.confirm({...});
}
```
