angular-translate-json
Advanced tools
Comparing version 0.2.3 to 0.3.0
@@ -28,7 +28,7 @@ // Imports | ||
}) | ||
export class Angular2TranslateJsonModule { | ||
export class AngularTranslateJsonModule { | ||
public static forRoot(): ModuleWithProviders { | ||
return { | ||
ngModule: Angular2TranslateJsonModule, | ||
ngModule: AngularTranslateJsonModule, | ||
providers: [ | ||
@@ -35,0 +35,0 @@ TranslateService |
{ | ||
"name": "angular-translate-json", | ||
"version": "0.2.3", | ||
"version": "0.3.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "index.ts", |
@@ -1,4 +0,6 @@ | ||
# Angular(latest) Translate Json | ||
Inspired by https://github.com/angular-translate/angular-translate | ||
# Angular Translate Json | ||
Translations module for latest version of angular. | ||
*Inspired by https://github.com/angular-translate/angular-translate* | ||
It's built to support latest angular version, with a friendly to use api. | ||
@@ -11,3 +13,3 @@ | ||
// Imports | ||
import { Angular2TranslateJsonModule, TranslateService } from 'angular-translate-json'; | ||
import { AngularTranslateJsonModule, TranslateService } from 'angular-translate-json'; | ||
@@ -18,3 +20,3 @@ | ||
imports: [ | ||
Angular2TranslateJsonModule.forRoot(), | ||
AngularTranslateJsonModule.forRoot(), | ||
] | ||
@@ -63,2 +65,37 @@ }) | ||
} | ||
``` | ||
``` | ||
##### 4. More options to use it | ||
You could either use it as a atttribute(directive) or pipe, or simply by calling the service directly. | ||
##### Directive | ||
```html | ||
<div class="greet" translate="COMMON.HELLO"></div> | ||
``` | ||
##### Pipe or filter | ||
```html | ||
<div class="greet">{{'COMMON.HELLO' | translate}}</div> | ||
``` | ||
##### Using the service | ||
```typescript | ||
import { TranslateService } from 'angular-translate-json'; | ||
@Component({ | ||
template: `{{myNameIs}} {{name}}` | ||
}) | ||
class NameBadgeComponent { | ||
myNameIs = ''; | ||
name = 'John Snow'; | ||
constructor( private translateService: TranslateService ) { | ||
translateService.getTranslation('COMMON.HELLO') | ||
.subscribe(res => { | ||
this.myNameIs = res; | ||
}); | ||
} | ||
} | ||
``` | ||
## Feedback | ||
Let me know if there's something broken and I'll be more than happy to address it. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9202
98