Skip to content

Commit

Permalink
feat(Ng2LocationConfig): use BrowserLocationConfig.
Browse files Browse the repository at this point in the history
  • Loading branch information
aitboudad committed Feb 12, 2017
1 parent ebce639 commit 7e0aef6
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions src/location/locationConfig.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,15 @@
/** @module ng2 */
/** */

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

export class Ng2LocationConfig {
private _isHtml5: boolean;
private _hashPrefix: string = "";

export class Ng2LocationConfig extends BrowserLocationConfig {
constructor(router: UIRouter, private _locationStrategy: LocationStrategy) {
this._isHtml5 = is(PathLocationStrategy)(_locationStrategy);
super(router, is(PathLocationStrategy)(_locationStrategy))
}

dispose() {}
port = () => null as number;
protocol = () => null as string;
host = () => null as string;
baseHref = () => this._locationStrategy.getBaseHref();
html5Mode = () => this._isHtml5;
hashPrefix = (newprefix?: string): string => {
if (isDefined(newprefix)) {
this._hashPrefix = newprefix;
}
return this._hashPrefix;
};
}
baseHref(href?: string): string {
return this._locationStrategy.getBaseHref();
}
}

0 comments on commit 7e0aef6

Please sign in to comment.