dev_lit
dev_lit

Reputation: 55

how to make a dynamic router with parameters in vaadin router

I have the following address http://localhost:3000/script?company=1

How to display the required component at this address? What's wrog with me code?

   {
            path: '/script?company=:companyId',
            component: 'script-page',
            action: (context, commands) => this.protectedRouter(context, commands)
        },

Upvotes: 0

Views: 329

Answers (1)

Johannes Tuikkala
Johannes Tuikkala

Reputation: 160

I think the problem is that the format /script?company=:companyId is wrong. The correct format should be like the following (assuming the companyId is required parameter)

{
    path: '/script/:companyId',
    component: 'script-page',
    action: (context, commands) => this.protectedRouter(context, commands)
},

See the Vaadin (Fusion) Router documentation for more details and examples how to use optional and wildcard URL parameters.

Upvotes: 1

Related Questions