Skip to content

Commit 97bef42

Browse files
committed
Merge branch 'release/3.0.0-beta5'
2 parents 9f83d35 + 14145d9 commit 97bef42

File tree

13 files changed

+399
-273
lines changed

13 files changed

+399
-273
lines changed

‎CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
<a name="3.0.0-beta5"></a>
2+
### 3.0.0-beta5 (2017-02-01)
3+
4+
Fix config and http injection <https://github.com/shprink/wp-api-angular/issues/20>
5+
16
<a name="3.0.0-beta4"></a>
27
### 3.0.0-beta4 (2017-01-27)
38

‎package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wp-api-angular",
3-
"version": "3.0.0-beta4",
3+
"version": "3.0.0-beta5",
44
"description": "WordPress WP-API v2 client for Angular2",
55
"main": "wp-api-angular.js",
66
"typings": "wp-api-angular.d.ts",
@@ -39,10 +39,10 @@
3939
"@angular/compiler": "^2.0.0",
4040
"@angular/compiler-cli": "^2.4.4",
4141
"@angular/core": "^2.0.0",
42-
"@angular/http": "^2.1.2",
42+
"@angular/http": "^2.0.0",
4343
"@angular/platform-browser": "^2.0.0",
4444
"@angular/platform-browser-dynamic": "^2.0.0",
45-
"rxjs": "^5.0.1"
45+
"rxjs": "^5.0.0"
4646
},
4747
"devDependencies": {
4848
"babel-core": "^6.10.4",

‎src/Comments.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
import { Injectable } from '@angular/core';
2-
1+
import { Injectable, Inject } from '@angular/core';
2+
import { Http } from '@angular/http';
33
// Need to import interfaces dependencies
44
// Bug TypeScript https://github.com/Microsoft/TypeScript/issues/5938
55
import { Observable } from 'rxjs/Observable';
66
import { RequestOptionsArgs } from '@angular/http/src/interfaces';
77
import { Response } from '@angular/http/src/static_response';
88

99
import { WpApiParent } from './Parent';
10+
import { WpApiConfig } from './tokens';
11+
import { WpApiAppConfig } from './wp-api-angular';
1012

1113
export interface IWpApiComments {
1214
getList(options?: RequestOptionsArgs): Observable<Response>;
@@ -18,6 +20,12 @@ export interface IWpApiComments {
1820

1921
@Injectable()
2022
export class WpApiComments extends WpApiParent implements IWpApiComments {
23+
constructor(
24+
@Inject(WpApiConfig) public config: WpApiAppConfig,
25+
public http: Http
26+
) {
27+
super(config, http);
28+
}
2129
getList(options = {}) {
2230
return this.httpGet(`/comments`, options)
2331
}

‎src/Custom.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Injectable } from '@angular/core';
1+
import { Injectable, Inject } from '@angular/core';
22
import { Http } from '@angular/http';
33

44
// Need to import interfaces dependencies
@@ -8,6 +8,7 @@ import { RequestOptionsArgs } from '@angular/http/src/interfaces';
88
import { Response } from '@angular/http/src/static_response';
99

1010
import { WpApiParent } from './Parent';
11+
import { WpApiConfig } from './tokens';
1112
import { WpApiAppConfig } from './wp-api-angular';
1213

1314
export interface IWpApiCustom {
@@ -20,9 +21,10 @@ export interface IWpApiCustom {
2021

2122
export 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()
4749
export 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`);

‎src/Media.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Injectable } from '@angular/core';
1+
import { Injectable, Inject } from '@angular/core';
2+
import { Http } from '@angular/http';
23

34
// Need to import interfaces dependencies
45
// Bug TypeScript https://github.com/Microsoft/TypeScript/issues/5938
@@ -7,6 +8,8 @@ import { RequestOptionsArgs } from '@angular/http/src/interfaces';
78
import { Response } from '@angular/http/src/static_response';
89

910
import { WpApiParent } from './Parent';
11+
import { WpApiConfig } from './tokens';
12+
import { WpApiAppConfig } from './wp-api-angular';
1013

1114
export interface IWpApiMedia {
1215
getList(options?: RequestOptionsArgs): Observable<Response>;
@@ -18,6 +21,12 @@ export interface IWpApiMedia {
1821

1922
@Injectable()
2023
export class WpApiMedia extends WpApiParent implements IWpApiMedia {
24+
constructor(
25+
@Inject(WpApiConfig) public config: WpApiAppConfig,
26+
public http: Http
27+
) {
28+
super(config, http);
29+
}
2130
getList(options = {}) {
2231
return this.httpGet(`/media`, options)
2332
}

‎src/Pages.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Injectable } from '@angular/core';
1+
import { Injectable, Inject } from '@angular/core';
2+
import { Http } from '@angular/http';
23

34
// Need to import interfaces dependencies
45
// Bug TypeScript https://github.com/Microsoft/TypeScript/issues/5938
@@ -7,6 +8,8 @@ import { RequestOptionsArgs } from '@angular/http/src/interfaces';
78
import { Response } from '@angular/http/src/static_response';
89

910
import { WpApiParent } from './Parent';
11+
import { WpApiConfig } from './tokens';
12+
import { WpApiAppConfig } from './wp-api-angular';
1013

1114
export interface IWpApiPages {
1215
getList(options?: RequestOptionsArgs): Observable<Response>;
@@ -22,6 +25,13 @@ export interface IWpApiPages {
2225

2326
@Injectable()
2427
export class WpApiPages extends WpApiParent implements IWpApiPages {
28+
constructor(
29+
@Inject(WpApiConfig) public config: WpApiAppConfig,
30+
public http: Http
31+
) {
32+
super(config, http);
33+
}
34+
2535
getList(options = {}) {
2636
return this.httpGet(`/pages`, options)
2737
}

‎src/Posts.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Injectable } from '@angular/core';
1+
import { Injectable, Inject } from '@angular/core';
2+
import { Http } from '@angular/http';
23

34
// Need to import interfaces dependencies
45
// Bug TypeScript https://github.com/Microsoft/TypeScript/issues/5938
@@ -7,6 +8,8 @@ import { RequestOptionsArgs } from '@angular/http/src/interfaces';
78
import { Response } from '@angular/http/src/static_response';
89

910
import { WpApiParent } from './Parent';
11+
import { WpApiConfig } from './tokens';
12+
import { WpApiAppConfig } from './wp-api-angular';
1013

1114
export interface IWpApiPosts {
1215
getList(options?: RequestOptionsArgs): Observable<Response>;
@@ -26,6 +29,12 @@ export interface IWpApiPosts {
2629

2730
@Injectable()
2831
export class WpApiPosts extends WpApiParent implements IWpApiPosts {
32+
constructor(
33+
@Inject(WpApiConfig) public config: WpApiAppConfig,
34+
public http: Http
35+
) {
36+
super(config, http);
37+
}
2938
getList(options = {}) {
3039
return this.httpGet(`/posts`, options)
3140
}

‎src/Statuses.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Injectable } from '@angular/core';
1+
import { Injectable, Inject } from '@angular/core';
2+
import { Http } from '@angular/http';
23

34
// Need to import interfaces dependencies
45
// Bug TypeScript https://github.com/Microsoft/TypeScript/issues/5938
@@ -7,6 +8,8 @@ import { RequestOptionsArgs } from '@angular/http/src/interfaces';
78
import { Response } from '@angular/http/src/static_response';
89

910
import { WpApiParent } from './Parent';
11+
import { WpApiConfig } from './tokens';
12+
import { WpApiAppConfig } from './wp-api-angular';
1013

1114
export interface IWpApiStatuses {
1215
getList(options?: RequestOptionsArgs): Observable<Response>;
@@ -15,6 +18,12 @@ export interface IWpApiStatuses {
1518

1619
@Injectable()
1720
export class WpApiStatuses extends WpApiParent implements IWpApiStatuses {
21+
constructor(
22+
@Inject(WpApiConfig) public config: WpApiAppConfig,
23+
public http: Http
24+
) {
25+
super(config, http);
26+
}
1827
getList(options = {}) {
1928
return this.httpGet(`/statuses`, options)
2029
}

‎src/Taxonomies.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Injectable } from '@angular/core';
1+
import { Injectable, Inject } from '@angular/core';
2+
import { Http } from '@angular/http';
23

34
// Need to import interfaces dependencies
45
// Bug TypeScript https://github.com/Microsoft/TypeScript/issues/5938
@@ -7,6 +8,8 @@ import { RequestOptionsArgs } from '@angular/http/src/interfaces';
78
import { Response } from '@angular/http/src/static_response';
89

910
import { WpApiParent } from './Parent';
11+
import { WpApiConfig } from './tokens';
12+
import { WpApiAppConfig } from './wp-api-angular';
1013

1114
export interface IWpApiTaxonomies {
1215
getList(options?: RequestOptionsArgs): Observable<Response>;
@@ -15,6 +18,12 @@ export interface IWpApiTaxonomies {
1518

1619
@Injectable()
1720
export class WpApiTaxonomies extends WpApiParent implements IWpApiTaxonomies {
21+
constructor(
22+
@Inject(WpApiConfig) public config: WpApiAppConfig,
23+
public http: Http
24+
) {
25+
super(config, http);
26+
}
1827
getList(options = {}) {
1928
return this.httpGet(`/taxonomies`, options)
2029
}

‎src/Terms.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Injectable } from '@angular/core';
1+
import { Injectable, Inject } from '@angular/core';
2+
import { Http } from '@angular/http';
23

34
// Need to import interfaces dependencies
45
// Bug TypeScript https://github.com/Microsoft/TypeScript/issues/5938
@@ -7,6 +8,8 @@ import { RequestOptionsArgs } from '@angular/http/src/interfaces';
78
import { Response } from '@angular/http/src/static_response';
89

910
import { WpApiParent } from './Parent';
11+
import { WpApiConfig } from './tokens';
12+
import { WpApiAppConfig } from './wp-api-angular';
1013

1114
export interface IWpApiTerms {
1215
getList(taxonomiesType: string, options?: RequestOptionsArgs): Observable<Response>;
@@ -20,6 +23,12 @@ const defaultTaxoType = 'categories';
2023

2124
@Injectable()
2225
export class WpApiTerms extends WpApiParent implements IWpApiTerms {
26+
constructor(
27+
@Inject(WpApiConfig) public config: WpApiAppConfig,
28+
public http: Http
29+
) {
30+
super(config, http);
31+
}
2332
getList(taxonomiesType = defaultTaxoType , options = {}) {
2433
return this.httpGet(`/${taxonomiesType}`, options)
2534
}

‎src/Types.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Injectable } from '@angular/core';
1+
import { Injectable, Inject } from '@angular/core';
2+
import { Http } from '@angular/http';
23

34
// Need to import interfaces dependencies
45
// Bug TypeScript https://github.com/Microsoft/TypeScript/issues/5938
@@ -7,6 +8,8 @@ import { RequestOptionsArgs } from '@angular/http/src/interfaces';
78
import { Response } from '@angular/http/src/static_response';
89

910
import { WpApiParent } from './Parent';
11+
import { WpApiConfig } from './tokens';
12+
import { WpApiAppConfig } from './wp-api-angular';
1013

1114
export interface IWpApiTypes {
1215
getList(options?: RequestOptionsArgs): Observable<Response>;
@@ -15,6 +18,12 @@ export interface IWpApiTypes {
1518

1619
@Injectable()
1720
export class WpApiTypes extends WpApiParent implements IWpApiTypes {
21+
constructor(
22+
@Inject(WpApiConfig) public config: WpApiAppConfig,
23+
public http: Http
24+
) {
25+
super(config, http);
26+
}
1827
getList(options = {}) {
1928
return this.httpGet(`/types`, options)
2029
}

‎src/Users.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Injectable } from '@angular/core';
1+
import { Injectable, Inject } from '@angular/core';
2+
import { Http } from '@angular/http';
23

34
// Need to import interfaces dependencies
45
// Bug TypeScript https://github.com/Microsoft/TypeScript/issues/5938
@@ -7,6 +8,8 @@ import { RequestOptionsArgs } from '@angular/http/src/interfaces';
78
import { Response } from '@angular/http/src/static_response';
89

910
import { WpApiParent } from './Parent';
11+
import { WpApiConfig } from './tokens';
12+
import { WpApiAppConfig } from './wp-api-angular';
1013

1114
export interface IWpApiUsers {
1215
getList(options?: RequestOptionsArgs): Observable<Response>;
@@ -19,6 +22,12 @@ export interface IWpApiUsers {
1922

2023
@Injectable()
2124
export class WpApiUsers extends WpApiParent implements IWpApiUsers {
25+
constructor(
26+
@Inject(WpApiConfig) public config: WpApiAppConfig,
27+
public http: Http
28+
) {
29+
super(config, http);
30+
}
2231
getList(options = {}) {
2332
return this.httpGet(`/users`, options)
2433
}

0 commit comments

Comments
 (0)