Skip to content

Commit 7b70b4a

Browse files
Merge pull request #50 from aitboudad/location
feat(Ng2LocationConfig): use BrowserLocationConfig.
2 parents ebce639 + 7e0aef6 commit 7b70b4a

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

src/location/locationConfig.ts

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,15 @@
11
/** @module ng2 */
22
/** */
33

4-
import { UIRouter, is, isDefined } from "ui-router-core";
4+
import { UIRouter, is, BrowserLocationConfig } from "ui-router-core";
55
import { LocationStrategy, PathLocationStrategy } from "@angular/common";
66

7-
export class Ng2LocationConfig {
8-
private _isHtml5: boolean;
9-
private _hashPrefix: string = "";
10-
7+
export class Ng2LocationConfig extends BrowserLocationConfig {
118
constructor(router: UIRouter, private _locationStrategy: LocationStrategy) {
12-
this._isHtml5 = is(PathLocationStrategy)(_locationStrategy);
9+
super(router, is(PathLocationStrategy)(_locationStrategy))
1310
}
1411

15-
dispose() {}
16-
port = () => null as number;
17-
protocol = () => null as string;
18-
host = () => null as string;
19-
baseHref = () => this._locationStrategy.getBaseHref();
20-
html5Mode = () => this._isHtml5;
21-
hashPrefix = (newprefix?: string): string => {
22-
if (isDefined(newprefix)) {
23-
this._hashPrefix = newprefix;
24-
}
25-
return this._hashPrefix;
26-
};
27-
}
12+
baseHref(href?: string): string {
13+
return this._locationStrategy.getBaseHref();
14+
}
15+
}

0 commit comments

Comments
 (0)