Pass route parameter to template context

Hi there…
I try to pass a dynamic route parameter to the context for a template like:

routes: [

	{
		path: '/user/:id',
		template: tUser,
		
		options: {
			context: {
				id:	'{{id}}',  
				data: allUserObject['{{id}}']      
			},
		},
	
	}
],

… Let’s assume I have an object with the whole user data (loaded on startup). The route with the dynamic parameter :id should pic the record set from the “allUserObject” to provide it within the context. But the ‘{{id}}’ within the context does not get replaced (kind of plausible)… but how do I catch the parameter here? Maybe I have the wrong approach - but what is the best practice for this?

You can access it in template as $route.params.id, otherwise use async route instead:

routes: [
  {
    path: '/user/:id',
    async(to, from, resolve, reject) {
      const id = to.params.id;
      resolve(
        {
          template: tUser,
        },
        {
          context: {
            id:	id,  
            data: allUserObject[id]      
          },
        }
      )
    }
  }
],

Hey - What a great support! You made my day :wink: