How to use questionmark in URl using angular 2

后端 未结 1 1621
天涯浪人
天涯浪人 2021-01-06 04:06

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/prom

相关标签:
1条回答
  • 2021-01-06 04:40

    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

    0 讨论(0)
提交回复
热议问题