import { DefaultUrlSerializer , UrlSerializer , UrlTree } from '@angular/router' ; export class CustomUrlSerializer implements UrlSerializer { private _defaultUrlSerializer : DefaultUrlSerializer = new DefaultUrlSerializer ( ) ; parse ( url ) { url = url . replace ( /\(/g , '%28' ) . replace ( /\)/g , '%29' ) ; return this . _defaultUrlSerializer . parse ( url ) ; } serialize ( tree ) { return this . _defaultUrlSerializer . serialize ( tree ) . replace ( /\(/g , '%28' ) . replace ( /\)/g , '%29' ) ; } }