New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

angular-translate-json

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-translate-json - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

4

index.ts

@@ -30,6 +30,8 @@ // Imports

public static forRoot(): ModuleWithProviders {
public static forRoot(config = null, values = null): ModuleWithProviders {
return {
ngModule: AngularTranslateJsonModule,
providers: [
{ provide: "CONFIG", useValue: config },
{ provide: "VALUES", useValue: values },
TranslateService

@@ -36,0 +38,0 @@ ]

{
"name": "angular-translate-json",
"version": "0.3.0",
"version": "0.3.1",
"license": "MIT",

@@ -12,10 +12,32 @@ "main": "index.ts",

],
"scripts": {},
"dependencies": {},
"devDependencies": {
"scripts": {
"test": "karma start"
},
"dependencies": {
"@angular/common": "^4.0.2",
"@angular/compiler": "^4.0.2",
"@angular/core": "^4.0.2",
"@angular/http": "^4.0.2",
"@angular/platform-browser": "^4.0.2",
"@angular/platform-browser-dynamic": "^4.0.2",
"rxjs": "^5.3.0",
"zone.js": "^0.8.5"
},
"devDependencies": {
"@angular/platform-browser": "^4.0.2",
"@types/jasmine": "^2.5.47",
"@types/node": "^7.0.12",
"angular2-template-loader": "^0.6.2",
"awesome-typescript-loader": "^3.1.2",
"core-js": "^2.4.1",
"jasmine": "^2.5.3",
"karma": "^1.6.0",
"karma-jasmine": "^1.1.0",
"karma-phantomjs-launcher": "^1.0.4",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "0.0.31",
"karma-webpack": "^2.0.3",
"typescript": "^2.2.2",
"webpack": "^2.3.3"
}
}
# Angular Translate Json
Translations module for latest version of angular.
Translations module for latest version of angular. It's built to support latest angular version, with a friendly to use api.
*Inspired by https://github.com/angular-translate/angular-translate*
> *Inspired by https://github.com/angular-translate/angular-translate*
It's built to support latest angular version, with a friendly to use api.
[![npm version](https://badge.fury.io/js/angular-translate-json.svg)](https://badge.fury.io/js/angular-translate-json)
## How to get it
It's up on npm, so you can do:
```bash
npm install --save angular-translate-json
```
## How it works

@@ -19,3 +25,9 @@

imports: [
AngularTranslateJsonModule.forRoot(),
AngularTranslateJsonModule.forRoot(
// You can either define the settings here
{
locale: 'en',
path: 'my/path/to/translations'
}
),
]

@@ -27,3 +39,3 @@ })

// Set the translations configurations
// Or here
translateService.setConfig({

@@ -30,0 +42,0 @@ locale: 'en',

@@ -1,4 +0,5 @@

import { Injectable } from '@angular/core';
import { Injectable, Inject } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Http } from '@angular/http';
import 'rxjs/add/operator/publishReplay';

@@ -8,7 +9,2 @@ @Injectable()

private config = {
path: '',
locale: ''
};
private httpObservable;

@@ -20,5 +16,23 @@ private cache;

* @param {Http} http
* @param {object} [config]
* @param {object} [values]
*/
constructor( private http: Http ) {}
constructor(
private http: Http,
@Inject('CONFIG') private config,
@Inject('VALUES') private values ) {
// Default configuration
if (!config) {
this.config = {
path: '',
locale: ''
};
}
if (!!values) {
this.cache = values;
}
}
/**

@@ -108,3 +122,3 @@ * Returns the url for translation files

// Cache the observable
this.httpObservable = this.httpObservable || this.http.get(url).share();
this.httpObservable = this.httpObservable || this.http.get(url).publishReplay(1).refCount();

@@ -111,0 +125,0 @@ // Subscribe to it

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc