
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
angular-json-rest-service
Advanced tools
Provides a simple active record factory wrapper service over a remote JSON ReST service for NG2
This package provides a simple Angular 2 service JsonRestService, which is a wrapper of @angular/http/Http.
JsonRestService expects the remote HTTP service to be a ReST service taking and returning JSON with the usual semantics. JsonRestService will hydrate records it pulls off the wire into a user defined class implementing ActiveRecord. Model implements a very basic ActiveRecord you can use as a base and extend.
JsonRestService is generic like this: JsonRestService<T extends ActiveRecord>. In order to dynamically create instances of type T (for get(), and find()), the JsonRestService constructor also requires an instance of ActiveRecordFactory<T>.
import { Component } from '@angular/core';
import { Http } from '@angular/http';
import 'angular-json-rest-service/rxjs-extensions';
import { JsonRestService, ActiveRecordFactory } from 'angular-json-rest-service/json-rest.service';
// Base implementations of ActiveRecord / ActiveRecordFactory interfaces.
import { Model } from 'angular-json-rest-service/model';
class Hero extends Model {
name: string;
power(): number {
return 69;
}
}
class HeroFactory extends ActiveRecordFactory<Hero>
{
create(object: Object, storage: JsonRestService<Hero>): Hero {
var model = new Hero(storage)
model.merge(object)
return model;
}
}
@Component({
selector: 'my-app',
template: `<h1>Hello {{hero.name}}. Your power is {{hero.power()}}</h1>`
})
export class AppComponent {
hero: Hero;
constructor(private http:Http) {
var myService = new JsonRestService<Model>(
http,
'/root/heroes',
new HeroFactory()
)
this.hero = new Hero(myService)
myService.find().toPromise().then((m: Hero[]) => {
this.hero = m[0];
console.log(m.map(n => n.toJson()))
})
}
}
FAQs
Provides a simple active record factory wrapper service over a remote JSON ReST service for NG2
We found that angular-json-rest-service demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.