mirror of
https://github.com/xuthus83/pigallery2.git
synced 2025-01-14 14:43:17 +08:00
fixing navigation parentheses error
This commit is contained in:
parent
0f4eb10c91
commit
81c3b6bca0
@ -53,6 +53,7 @@ import {SettingsService} from "./settings/settings.service";
|
||||
import {ShareSettingsComponent} from "./settings/share/share.settings.component";
|
||||
import {BasicSettingsComponent} from "./settings/basic/basic.settings.component";
|
||||
import {OtherSettingsComponent} from "./settings/other/other.settings.component";
|
||||
import {DefaultUrlSerializer, UrlSerializer, UrlTree} from '@angular/router';
|
||||
|
||||
@Injectable()
|
||||
export class GoogleMapsConfig {
|
||||
@ -69,6 +70,21 @@ export class MyHammerConfig extends HammerGestureConfig {
|
||||
}
|
||||
}
|
||||
|
||||
class CustomUrlSerializer implements UrlSerializer {
|
||||
private _defaultUrlSerializer: DefaultUrlSerializer = new DefaultUrlSerializer();
|
||||
|
||||
parse(url: string): UrlTree {
|
||||
// Encode parentheses
|
||||
url = url.replace(/\(/g, '%28').replace(/\)/g, '%29');
|
||||
// Use the default serializer.
|
||||
return this._defaultUrlSerializer.parse(url)
|
||||
}
|
||||
|
||||
serialize(tree: UrlTree): string {
|
||||
return this._defaultUrlSerializer.serialize(tree).replace(/%28/g, '(').replace(/%29/g, ')');
|
||||
}
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
BrowserModule,
|
||||
@ -115,6 +131,7 @@ export class MyHammerConfig extends HammerGestureConfig {
|
||||
OtherSettingsComponent,
|
||||
StringifyRole],
|
||||
providers: [
|
||||
{provide: UrlSerializer, useClass: CustomUrlSerializer},
|
||||
{provide: LAZY_MAPS_API_CONFIG, useClass: GoogleMapsConfig},
|
||||
{provide: HAMMER_GESTURE_CONFIG, useClass: MyHammerConfig},
|
||||
NetworkService,
|
||||
|
Loading…
x
Reference in New Issue
Block a user