Skip to content

Commit

Permalink
Update doc & version
Browse files Browse the repository at this point in the history
  • Loading branch information
robisim74 committed Apr 7, 2017
1 parent 8dd15cc commit c765f46
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
23 changes: 21 additions & 2 deletions doc/spec.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Angular localization library specification
Library version: 3.0.2
Library version: 3.0.3

## Table of contents
* [1 Library structure](#1)
Expand All @@ -14,6 +14,7 @@ Library version: 3.0.2
* [3.1.1 Messages](#3.1.1)
* [3.1.2 Dates & Numbers](#3.1.2)
* [3.1.3 OnPush ChangeDetectionStrategy](#3.1.3)
* [3.1.4 ngOnDestroy method](#3.1.4)
* [3.2 Directives](#3.2)
* [3.3 Getting the translation in component class](#3.3)
* [4 Changing language, default locale or currency at runtime](#4)
Expand Down Expand Up @@ -311,6 +312,24 @@ export class HomeComponent extends Localization {
}
```

#### <a name="3.1.4"/>3.1.4 ngOnDestroy method
When you extend `Translation` or `Localization` classes, the component inherits
`ngOnDestroy` method that cancels the subscriptions to update the pipes parameters.
If you override the `ngOnDestroy` method in your component to cancel its subscriptions,
you should call also `cancelPipesSubscriptions`:
```TypeScript
ngOnDestroy() {
// Cancels the subscriptions of the component.
this.subscriptions.forEach((subscription: ISubscription) => {
if (typeof subscription !== "undefined") {
subscription.unsubscribe();
}
});

this.cancelPipesSubscriptions();
}
```

### <a name="3.2"/>3.2 Directives
Type | Format | Html syntax
---- | ------ | -----------
Expand Down Expand Up @@ -344,7 +363,7 @@ Parameters:
```
*N.B. You can dynamically change attributes, parameters and expressions values.
If you use in the component only the directives and not the pipes,
you don't need to import services and extend `Translation` or `Localization` class.*
you don't need to import services and extend `Translation` or `Localization` classes.*

### <a name="3.3"/>3.3 Getting the translation in component class
To get the translation in component class, `TranslationService` has the following methods:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-l10n",
"version": "3.0.2",
"version": "3.0.3",
"description": "An Angular library to translate messages, dates and numbers",
"main": "./bundles/angular-l10n.umd.js",
"module": "./modules/angular-l10n.es5.js",
Expand Down

0 comments on commit c765f46

Please sign in to comment.