-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathLoaders.ts
More file actions
29 lines (24 loc) · 843 Bytes
/
Copy pathLoaders.ts
File metadata and controls
29 lines (24 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { Http, HttpModule } from '@angular/http';
import { stripTrailingSlash } from './utils';
export abstract class WpApiLoader {
abstract getWebServiceUrl(postfix: string): string;
abstract baseUrl: string;
abstract namespace: string;
}
export class WpApiStaticLoader implements WpApiLoader {
completeUrl: string;
constructor(
private http: Http,
private _baseUrl: string = 'http://changeYourDomainHere.com/wp-json',
private _namespace: string = '/wp/v2'
) {
this.completeUrl = `${stripTrailingSlash(this.baseUrl)}${this.namespace}`;
}
set baseUrl(val: string) { }
get baseUrl(): string { return this._baseUrl; }
set namespace(val: string) {}
get namespace(): string { return this._namespace; }
public getWebServiceUrl(postfix: string): string {
return `${this.completeUrl}${postfix}`
}
}