0

I have a little problem with Angular 4 # RouterModule , im creating an ID for a root

   RouterModule.forRoot([
        {path: ''                 , component: HomeComponent},
            {path: 'cautare/:id'  , component: RezultComponent},
            {path: 'profile'      , component: ProfileComponent},
            {path: 'contact'      , component: ContactComponent}
        ]),

in this rout ID i need to give something like this ' 3003KIV,BCM1504#e' When my form triggers search im creating id dynamically

                // Pacs Class
                if (date[2].pacsClass) {
                    if (date[2].pacsClass === 'Economic') {
                        Link = Link + '#e';
                    }
                    if (date[2].pacsClass === 'Premium Economic') {
                        Link = Link + '#P';
                    }
                    if (date[2].pacsClass === 'Business') {
                        Link = Link + '#B';
                    }
                    console.log(date[2].pacsClass);
                }
            return Link;

but in Browser URL is adding %23 instead of #

1 Answers1

0

It is just encoded data passed via url. You can still decode it when you get that parameter and it will again have the look which you have passed. Angular by default encodes the url. For not encoded urls you need to write custom UrlSerializer.

For more see here

Suren Srapyan
  • 66,568
  • 14
  • 114
  • 112