angularjs - Problems : Read a Json and Create a List (Ionic) -


i want create list when read json error appears how can fix it?

   import { injectable } '@angular/core';    import { http } '@angular/http';    import 'rxjs/add/operator/map';    import 'rxjs/add/operator/do';     /*     generated class kpisprovider provider.     see https://angular.io/docs/ts/latest/guide/dependency-injection.html    more info on providers , angular di.    */    @injectable()    export class kpisprovider {          private url: string = 'https://private-anon-3cb8931ec8-kpisapi1.apiary-mock.com/api/projects';         constructor(private http: http) {          console.log('hello kpisprovider provider');        }         getprojects(){          return this.http.get(this.url) .        .do((res: response) => console.log(res))          .map((res: response) => res.json());        }     } 

and error is:

argument of type '(res: response) => void' not assignable parameter of type 'partialobserver'. type '(res: response) => void' not assignable type 'completionobserver'. property 'complete' missing in type '(res: response) => void'.

  l22:  return this.http.get(this.url)   l23:  .do((res : response) => console.log(res))   l24:  .map((res : response) => res.json()); 

do have period . in query you're running?

return this._http.get(this.url)     .map((res: response) => res.json())      .catch(this._errorhandler); 

the method that's subscribing http call can log out results


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -