Skip to content

Commit

Permalink
fix(): Fixed documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
akserg committed Aug 28, 2016
1 parent b62057f commit 4ec77fb
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ Finally, you can use *ng2-toasty* in your Angular 2 project:
- Instantiate `ToastyService, ToastyConfig` in the bootstrap of your application;
- Add `ToastyComponent` to the "directives" property of your application component;
- Add `<ng2-toasty></ng2-toasty>` tag in template of your application component.
- Inject style into your web page. Choose one of the following files;
- `style-default.css` - Contains DEFAULT theme
- `style-bootstrap.css` - Contains Bootstrap 3 theme
- `style-material.css` - Contains Material Design theme
- Assign the selected theme name to the `theme` property of the instance of ToastyConfig.

```js
import {Component} from '@angular/core';
import {ToastyService, ToastyConfig, ToastyComponent, ToastOptions, ToastData} from 'ng2-toasty';
import {bootstrap} from '@angular/platform/browser';

@Component({
selector: 'app',
Expand All @@ -60,7 +64,11 @@ import {bootstrap} from '@angular/platform/browser';
})
export class AppComponent {

constructor(private toastyService:ToastyService) { }
constructor(private toastyService:ToastyService, private toastyConfig: ToastyConfig) {
// Assign the selected theme name to the `theme` property of the instance of ToastyConfig.
// Possible values: default, bootstrap, material
this.toastyConfig.theme = 'material';
}

addToast() {
// Just add default Toast with title only
Expand All @@ -87,8 +95,6 @@ export class AppComponent {
this.toastyService.warning(toastOptions);
}
}

bootstrap(AppComponent);
```

## How dynamically update title and message of a toast
Expand All @@ -97,7 +103,6 @@ Here is an example of how to dynamically update message and title of individual
```js
import {Component} from '@angular/core';
import {ToastyService, ToastyConfig, ToastyComponent, ToastOptions, ToastData} from 'ng2-toasty';
import {bootstrap} from '@angular/platform/browser';
import {Subject, Observable, Subscription} from 'rxjs/Rx';

@Component({
Expand Down Expand Up @@ -163,8 +168,6 @@ export class AppComponent {
}
}
}

bootstrap(AppComponent);
```

## How to close specific toast
Expand All @@ -173,7 +176,6 @@ Here is an example of how to close an individual toast:
```js
import {Component} from '@angular/core';
import {ToastyService, ToastyConfig, ToastyComponent, ToastOptions, ToastData} from 'ng2-toasty';
import {bootstrap} from '@angular/platform/browser';
import {Subject, Observable, Subscription} from 'rxjs/Rx';

@Component({
Expand Down Expand Up @@ -241,12 +243,10 @@ export class AppComponent {
}
}
}

bootstrap(AppComponent);
```

# License
[MIT](/LICENSE)

# Credits
Inspired by [angular-toasty](https://github.com/teamfa/angular-toasty)

# License
[MIT](/LICENSE)

0 comments on commit 4ec77fb

Please sign in to comment.