Can't resolve all parameters for WpProvider: ([object Object],?,[object Object])


#1

Below is my code from provider:


import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import 'rxjs/add/operator/map';
import { WpApiPosts, WpApiMedia, WpApiUsers } from 'wp-api-angular';
/*
  Generated class for the WpProvider provider.

  See https://angular.io/docs/ts/latest/guide/dependency-injection.html
  for more info on providers and Angular DI.
*/

export class Post {
	public media_url: Observable<string>;
	constructor(public authorId: number, public id: number, public title: string, public content: string, public exxerpt: string, public date, public mediaId?: number) {}
}

export class User {
	constructor(public id: number, public name: string, public userImageUrl: string) {}
}

@Injectable()
export class WpProvider {
users: User[];

  constructor(public wpApiPosts: WpApiPosts, public wpApiMedia, public wpApiUsers: WpApiUsers) {
  this.wpApiUsers.getList()
  .map(res =>res.json())
  .subscribe(data => {
  this.users = [];
  for (let user of data) {
  let oneUser = new User(user['id'], user['name'], user['avatar_urls'] ['96']);
  this.users.push(oneUser);
  }
  })
   
  }


}

#2

You seem to have forgotten to give this a type, so DI doesn’t know what to do.


#3

Please edit your post and use the </> button above the post input field to format your code or error message or wrap it in ``` (“code fences”) manually. This will make sure your text is readable and if it recognizes the programming language it also automatically adds code syntax highlighting. Thanks.