Skip to content Skip to sidebar Skip to footer

How To Use Questionmark In Url Using Angular 2

I am new in Angular 2 Here, shown code for router where my url would be display. Router Code Now, When I run that code the url look like this.. localhost:50465/promotion%3Fid%3D/5

Solution 1:

In your scenario you can use code for router look like this :

{       
    path: 'home/promotiondetail',        
    component: component name
}

and in your html side you can declare your router code look like this :

[routerLink]="['promotiondetail']" [queryParams]="{ id: {{id}} }"

show when you run this code you can get url look like this :

http://localhost:50465/promotion?id=132

Hope,this is useful. For more information use this link : https://angular-2-training-book.rangle.io/handout/routing/routeparams.html

Post a Comment for "How To Use Questionmark In Url Using Angular 2"