-
Notifications
You must be signed in to change notification settings - Fork 2k
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to get current controller and action name? #1031
Comments
Yes, controller name and action are stored in req.target = {
controller : 'XXX',
action: 'XXX'
} You can access this variable both on back end and front end. |
thx |
This is interesting, how can this value be accessed in the front-end Lukas? |
@kokujin For example, let's say you've got a link and you want it to be highlighted only on particular controller/action: <a href="#" class="<%= (req.target.action === 'index') ? 'highlighted' : '' %>">Link</a> Hope that helps! |
did this go away? I'm using the latest version and don't have target on the req object. |
try |
That is the issue. If it is a custom action and/or route then I already know my controller / action. I was looking for this because I wanted to do a pre-flight check in a policy that ran before all my blueprint actions. I needed the action being preformed on the model. |
How to get the controller and action name for request.referrer in sails. sails.log(req.referrer); gives me controller/action. How to get controller and action name from req.referrer directly?? |
Hello Guys, news? |
@clarkorz Thanks :) |
with request you can get info
|
In Sails ≥v1, from a view or
|
I want to get current controller and action name string,
is that a method?
The text was updated successfully, but these errors were encountered: