1.0.2 • Published 7 years ago
ngx-simple-resource v1.0.2
ngx-simple-resource
Install
npm install --save ngx-simple-resource
Usage
// In app.module
import { NgxResourceModule } from 'ngx-simple-resource';
...
imports: [
NgxResourceModule
...
// Service file example
import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {HttpClientService} from 'ngx-simple-resource';
import {HelperService} from './helper.service';
import {Router} from "@angular/router";
@Injectable()
export class OrderService extends HttpClientService {
url: any = 'orders';
constructor(public http: HttpClient, public helper_service: HelperService, public router: Router) {
super(http, router);
}
own(queryParams = {}) {
return this.get(this.url + '/own', queryParams);
}
feedback(queryParams = {}) {
return this.put(this.url + '/:_id/feedback', queryParams, queryParams);
}
}
// In component
this.orderService.query('', {}).subscribe((res) => {
this.orders = res;
})
Methods
- create
- show
- update
- remove
- query
Contribution
Contribution is welcome.
License
MIT © Flycode LLC