1- import { Injectable } from '@angular/core' ;
1+ import { Injectable , Inject } from '@angular/core' ;
22import { Http } from '@angular/http' ;
33
44// Need to import interfaces dependencies
@@ -8,6 +8,7 @@ import { RequestOptionsArgs } from '@angular/http/src/interfaces';
88import { Response } from '@angular/http/src/static_response' ;
99
1010import { WpApiParent } from './Parent' ;
11+ import { WpApiConfig } from './tokens' ;
1112import { WpApiAppConfig } from './wp-api-angular' ;
1213
1314export interface IWpApiCustom {
@@ -20,9 +21,10 @@ export interface IWpApiCustom {
2021
2122export class Custom extends WpApiParent implements IWpApiCustom {
2223 constructor (
23- public config : WpApiAppConfig ,
24+ @ Inject ( WpApiConfig ) public config : WpApiAppConfig ,
2425 public http : Http ,
25- public entityName : string ) {
26+ public entityName : string
27+ ) {
2628 super ( config , http ) ;
2729 }
2830 getList ( options = { } ) {
@@ -45,6 +47,13 @@ export class Custom extends WpApiParent implements IWpApiCustom {
4547
4648@Injectable ( )
4749export class WpApiCustom extends WpApiParent {
50+ constructor (
51+ @Inject ( WpApiConfig ) public config : WpApiAppConfig ,
52+ public http : Http
53+ ) {
54+ super ( config , http ) ;
55+ }
56+
4857 getInstance ( entityName = '' ) {
4958 if ( typeof entityName !== 'string' ) {
5059 throw new Error ( `getInstance needs an entity name` ) ;
0 commit comments