Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ng2-api

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng2-api

Angular2 API services

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12
decreased by-80.33%
Maintainers
1
Weekly downloads
 
Created
Source

ng2-api

Angular2 API services - work in progress

Install

npm i --save ng2-api

Import

import {ApiService} from 'ng2-api';

Usage

import {Inject, Injectable} from 'angular2/core';
import {Http, Response} from 'angular2/http';
import {ApiService} from 'ng2-api';

export class Post {
  id: number;
  title: string;
  body: string;

  constructor(object: Object) {
    Object.assign(this, object);
  }
}

@Injectable()
export class PostsService extends ApiService<Post> {
  constructor(public http: Http) {
    super(http, 'http://jsonplaceholder.typicode.com', 'posts');
  }

  serialize(model: Post): string {
    return JSON.stringify({post: model});
  }
}

ApiService methods

find(id: number | string): Observable<Post>
findAll(search?: any): Observable<Post[]>
create(model: Post): Observable<Post>
update(model: Post): Observable<Post>
delete(model: Post): Observable<boolean>

License

MIT

Keywords

FAQs

Package last updated on 01 May 2016

Did you know?

Socket

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.

Install

Related posts

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