Where can I find the route data property values?

Hi,

I am trying to to get the data property of a configured route in a route hook. I have the following route:

{		
    path: [''],
    component: () => import('../views/validate-workspace/validate-workspace'),
    title: '',
    data: { allowAnonymous: false }
} as IRoute,

and the following hook:

@lifecycleHooks()
export class CheckAuthenticationHook {
    canLoad(viewModel: any, params: Parameters, instruction: RoutingInstruction, navigation: Navigation) {
        console.log(instruction, navigation);
        console.log(navigation.data);
        return false;
    }
}

I tried looking in the navigation which also has a data property but that one is always undefined. I would expect { allowAnonymous: false } to be accessible somewhere in the route hook. Any help would be appreciated.

Never mind. I found it in instruction.route.match.data.

1 Like