From 7e0aef6f0cf2fb5ce29419fda3b2c50dea95c908 Mon Sep 17 00:00:00 2001 From: Abdellatif Ait boudad Date: Sun, 12 Feb 2017 11:57:17 +0000 Subject: [PATCH] feat(Ng2LocationConfig): use BrowserLocationConfig. --- src/location/locationConfig.ts | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/src/location/locationConfig.ts b/src/location/locationConfig.ts index cdf64c0d5..954682fd2 100644 --- a/src/location/locationConfig.ts +++ b/src/location/locationConfig.ts @@ -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; - }; -} \ No newline at end of file + baseHref(href?: string): string { + return this._locationStrategy.getBaseHref(); + } +}