ardyhim

api.ts search

Sep 5th, 2016
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { Injectable } from '@angular/core';
  2. import { Http } from '@angular/http';
  3. import 'rxjs/add/operator/map';
  4.  
  5. /*
  6.   Generated class for the Api provider.
  7.  
  8.   See https://angular.io/docs/ts/latest/guide/dependency-injection.html
  9.   for more info on providers and Angular 2 DI.
  10. */
  11. @Injectable()
  12. export class Api {
  13.  
  14.   constructor(private http: Http) {}
  15.  
  16.   index(id){
  17.     return this.http.get('http://localhost/ionWordpress/wp-json/wp/v2/posts/?_embed&?filter[order]=DESC&filter[posts_per_page]=5&page='+id)
  18.   }
  19.  
  20.   search(keyword, id){
  21.     return this.http.get(
  22.       "http://localhost/ionWordpress/wp-json/wp/v2/posts?_embed&?filter[order]=DESC&filter[posts_per_page]=5&search=" + keyword + "&page="+id
  23.     );
  24.   }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment