How can I specify query parameters by routerLink directive

前端 未结 2 1155
醉酒成梦
醉酒成梦 2021-01-18 04:45

I am experimenting the new router (version 3.0.0-alpha.7) and would like to know how to specify query parameters by routerLink directive?

The Router.navigate() metho

相关标签:
2条回答
  • 2021-01-18 05:15

    In the new router component, you can do it in this way:

    Passing a parameter in the URL:

    <a [routerLink]="['/component-a', 1]">Component A</a>
    

    Passing e query parameter:

    <a [routerLink]="['/component-a', { x: 1 }]">Crisis Center</a>
    
    0 讨论(0)
  • 2021-01-18 05:34

    You can do something like this

    <a [routerLink]="['/component-a']" [queryParams]="{x: 1}">Component A</a>
    
    0 讨论(0)
提交回复
热议问题