mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 21:48:42 +08:00
fix(di): update dependency injection and default configs
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
import { Injectable, OpaqueToken } from '@angular/core';
|
||||
import { Location } from '@angular/common';
|
||||
|
||||
import { App } from '../components/app/app';
|
||||
@ -30,7 +29,6 @@ import { ViewController } from './view-controller';
|
||||
*/
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class DeepLinker {
|
||||
segments: NavSegment[] = [];
|
||||
history: string[] = [];
|
||||
@ -415,9 +413,6 @@ export function setupDeepLinker(app: App, serializer: UrlSerializer, location: L
|
||||
}
|
||||
|
||||
|
||||
export const UserDeepLinkConfig = new OpaqueToken('USERLINKS');
|
||||
|
||||
|
||||
export function normalizeUrl(browserUrl: string): string {
|
||||
browserUrl = browserUrl.trim();
|
||||
if (browserUrl.charAt(0) !== '/') {
|
||||
|
@ -1,15 +1,13 @@
|
||||
import { Inject, Injectable } from '@angular/core';
|
||||
import { OpaqueToken } from '@angular/core';
|
||||
|
||||
import { DeepLinkConfig, NavLink, NavSegment } from './nav-util';
|
||||
import { isArray, isBlank, isPresent, pascalCaseToDashCase } from '../util/util';
|
||||
import { UserDeepLinkConfig } from './deep-linker';
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class UrlSerializer {
|
||||
links: NavLink[];
|
||||
|
||||
constructor(@Inject(UserDeepLinkConfig) config: DeepLinkConfig) {
|
||||
constructor(config: DeepLinkConfig) {
|
||||
if (config && isArray(config.links)) {
|
||||
this.links = normalizeLinks(config.links);
|
||||
|
||||
@ -265,3 +263,9 @@ function sortConfigLinks(a: NavLink, b: NavLink) {
|
||||
}
|
||||
|
||||
const URL_REPLACE_REG = /\s+|\?|\!|\$|\,|\.|\+|\"|\'|\*|\^|\||\/|\\|\[|\]|#|%|`|>|<|;|:|@|&|=/g;
|
||||
|
||||
export const DeepLinkConfigToken = new OpaqueToken('USERLINKS');
|
||||
|
||||
export function setupUrlSerializer(userDeepLinkConfig: any): UrlSerializer {
|
||||
return new UrlSerializer(userDeepLinkConfig);
|
||||
}
|
||||
|
Reference in New Issue
Block a user