How to use the Urlserialize

0

I create a class.ts with this code

import {UrlSerializer, UrlTree, DefaultUrlSerializer} from '@angular/router';

export class CustomUrlSerializer implements UrlSerializer {
  parse(url: any): UrlTree {
     let dus = new DefaultUrlSerializer();
     return dus.parse(url);
    }

    serialize(tree: UrlTree): any {
      const dus = new DefaultUrlSerializer();
      return dus.serialize(tree);
    }

}

and then I call it in the app.module.ts

asi

import {CustomUrlSerializer} from './models/CustomUrlSerializer';

@NgModule({
providers: [DataService, XMLSerializer , CustomUrlSerializer],
}]

but nothing happens, what am I doing wrong,

I want to change my url of this link

to this link

    
asked by Jesus Cabrita 20.10.2018 в 21:31
source

0 answers