NodeDad
NodeDad

Reputation: 1537

Detecting if a route is a resource or route

As the titles says, im looking for a way to detect if the route that im using is a resource or just a route. For those of you confused im speaking about the router structure of the application. For example 'person' is my resource and it has the routes 'edit', 'list' and 'view'... i need to be able to know from the routes standpoint if its a normal route, or a resource.

EDIT: I actually went ahead and just created a controller for each of my resources and assigned it a property isResource: true. This will suffice for what im doing but if anyone has a way to detect this in the routes willTransition or didTransition that would be greatly appreciated!

Upvotes: 0

Views: 93

Answers (1)

Buck Doyle
Buck Doyle

Reputation: 6397

From looking at the source, I don’t think it’s possible. The relevant lines from the definition of the resource method:

options.resetNamespace = true;
this.route(name, options, callback);

I can’t see anywhere in route that the resource origin of a route declaration is preserved in the generated route.

Upvotes: 1

Related Questions