Skip to content

Commit

Permalink
Updated README and CHANGELOG.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicola Pacucci committed Feb 19, 2019
1 parent 39dc9d3 commit 79ef18e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,9 @@
# 2.0.0

### Notes

* Added template context management

# 0.9.5

### Notes
Expand Down
30 changes: 16 additions & 14 deletions README.md
Expand Up @@ -110,43 +110,45 @@ This are the currently available access methods:

| Method | Description
---| ---
`success(title: any, content?: any, override?: any)` | Creates a success notification with the provided title and content.
`error(title: any, content?: any, override?: any)` | Creates an error notification with the provided title and content.
`alert(title: any, content?: any, override?: any)` | Creates an alert notification with the provided title and content.
`warn(title: any, content?: any, override?: any)` | Creates a warn notification with the provided title and content.
`info(title: any, content?: any, override?: any)` | Creates an info notification with the provided title and content.
`bare(title: any, content?: any, override?: any)` | Creates a bare notification with the provided title and content. This notification type is best used when adding custom html.
`create(title: any, content: any = '', type: string = 'success', override?: any)` | Use this method to create any notification type ['success', 'error', 'alert', 'info', 'bare'].
`html(html: any, type: string = 'success', override?: any, icon: string = 'bare')` | Use this method to create a notification with custom html. By specifying an icon (success, error, alert, info or warn) you can use the default icons in addition to your custom html. If you do not explicitly pass an icon param no icon will be shown by default.
`success(title: any, content?: any, override?: any, context?: any)` | Creates a success notification with the provided title and content.
`error(title: any, content?: any, override?: any, context?: any)` | Creates an error notification with the provided title and content.
`alert(title: any, content?: any, override?: any, context?: any)` | Creates an alert notification with the provided title and content.
`warn(title: any, content?: any, override?: any, context?: any)` | Creates a warn notification with the provided title and content.
`info(title: any, content?: any, override?: any, context?: any)` | Creates an info notification with the provided title and content.
`bare(title: any, content?: any, override?: any, context?: any)` | Creates a bare notification with the provided title and content. This notification type is best used when adding custom html.
`create(title: any, content: any = '', type: string = 'success', override?: any, context?: any)` | Use this method to create any notification type ['success', 'error', 'alert', 'info', 'bare'].
`html(html: any, type: string = 'success', override?: any, icon: string = 'bare', context?: any)` | Use this method to create a notification with custom html. By specifying an icon (success, error, alert, info or warn) you can use the default icons in addition to your custom html. If you do not explicitly pass an icon param no icon will be shown by default.
`remove(id?: string)` | Removes the notification that has the provided id or removes all currently open notifications if no id was provided.

The `title` and `content` arguments can be a string, html string or `TemplateRef`.
The `title`, `content` and `html` arguments can be a string, html string or `TemplateRef`. Now it's also possible to pass the datas (context) to the `TemplateRef` by using the optional `context` argument.

### Example using `TemplateRef`

To use a `TemplateRef` in the title or content you need to create it in a component template:

```html
<ng-template #example>
<p>Simple example</p>
<ng-template #example let-title="title">
<p>{{title}}</p>
</ng-template>
```

Then you need to somehow get it to the component:

```ts
```ts
title: string = 'Winter is coming';
@ViewChild('example') example: TemplateRef<any>;

open() {
this._service.success(this.example);
let context: any = {title: this.title};
this._service.html(this.example, null, null, null, context);
}
```

You could also pass the template through the `open()` method:

```ts
open(temp: TemplateRef<any>) {
this._service.success(temp);
this._service.html(temp, null, null, null, context);
}
```

Expand Down

0 comments on commit 79ef18e

Please sign in to comment.