title: How to add and integrate the pull to refresh feature in Ionic 3
body: <p>Am working on an <strong>Ionic App integrate</strong>d with <strong>wordpress</strong> and the data is pulled using the <strong>REST API (JSON)</strong> </p>
  
  <p>I have the code below in one of my .ts files which executes the infinite scroll perfectly</p>
  
  <pre><code>doInfinite(infiniteScroll) {
      let page = (Math.ceil(this.posts.length/10)) + 1;
      let loading = true;
  
      this.wordpressService.getRecentPosts(this.categoryId, page)
      .subscribe(data =&gt; {
        for(let post of data){
          if(!loading){
            infiniteScroll.complete();
          }
          post.excerpt.rendered = post.excerpt.rendered.split('&lt;a')[0] + "&lt;/p&gt;";
          this.posts.push(post);
          loading = false;
        }
      }, err =&gt; {
        this.morePagesAvailable = false;
      })
    }
  </code></pre>
  
  <p>I have a feeling some code should be added in the snippet below to execute the pull to refresh functionality and be able to load new posts</p>
  
  <pre><code> doRefresh(refresher) {
      console.log('Begin async operation', refresher);
  
      setTimeout(() =&gt; {
        console.log('Async operation has ended');
        refresher.complete();
      }, 2000);
    }
  </code></pre>
  
  <p><strong>EDIT</strong>
  Here is how my <strong>provider/service</strong> looks like</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { Http, Headers } from '@angular/http';
  export const WORDPRESS_URL = 'http://www.example.com/';
  export const WORDPRESS_REST_API_URL = WORDPRESS_URL + 'wp-json/wp/v2/';
  import { Observable } from 'rxjs/Observable';
  import 'rxjs/add/operator/map';
  import 'rxjs/add/observable/forkJoin';
  
  
  @Injectable()
  export class WordpressService {
    constructor(public http: Http){}
  
    getRecentPosts(categoryId:number, page:number = 1){
      //if we want to query posts by category
      let category_url = categoryId? ("&amp;categories=" + categoryId): "";
  
      return this.http.get(
        WORDPRESS_REST_API_URL
        + 'posts?page=' + page
        + category_url)
      .map(res =&gt; res.json());
    }
  
    getRecentFewPosts(categoryId:number, page:number = 1){
      //if we want to query posts by category
      let category_url = categoryId? ("&amp;categories=" + categoryId): "";
  
      return this.http.get(
        WORDPRESS_REST_API_URL
        + 'posts?per_page=5&amp;page=' + page
        + category_url)
      .map(res =&gt; res.json());
    }
  
    getRecentPostsByTag(tagId:number, page:number = 1){
      //if we want to query posts by tag
      let tag_url = tagId? ("&amp;tags=" + tagId): "";
  
      return this.http.get(
        WORDPRESS_REST_API_URL
        + 'posts?page=' + page
        + tag_url)
      .map(res =&gt; res.json());
    }
  
    getComments(postId:number, page:number = 1){
      return this.http.get(
        WORDPRESS_REST_API_URL
        + "comments?post=" + postId
        + '&amp;page=' + page)
      .map(res =&gt; res.json());
    }
  
    getAuthor(author){
      return this.http.get(WORDPRESS_REST_API_URL + "users/" + author)
      .map(res =&gt; res.json());
    }
  
    getPostCategories(post){
      let observableBatch = [];
  
      post.categories.forEach(category =&gt; {
        observableBatch.push(this.getCategory(category));
      });
  
      return Observable.forkJoin(observableBatch);
    }
  
    getCategory(category){
      return this.http.get(WORDPRESS_REST_API_URL + "categories/" + category)
      .map(res =&gt; res.json());
    }
  
    createComment(postId, user, comment){
      let header: Headers = new Headers();
      header.append('Authorization', 'Bearer ' + user.token);
  
      return this.http.post(WORDPRESS_REST_API_URL + "comments?token=" + user.token, {
        author_name: user.displayname,
        author_email: user.email,
        post: postId,
        content: comment
      },{ headers: header })
      .map(res =&gt; res.json());
    }
  }
  </code></pre>
  
  <p>Any help will be much appreciated. Thanks</p>