Get the name of controller, from JS
getControllerName() { | |
// Ex) DOMAIN.com/NAME_SPACE/CONTROLLER_NAME/ACTION | |
var pathname = window.location.pathname; // /NAME_SPACE/CONTROLLER_NAME/ACTION | |
let splitedPathnames = pathname.replace(/\//, ''); // [ 'NAME_SPACE', 'CONTROLLER_NAME', 'ACTION' ] | |
return splitedPathnames.split('/')[1]; // CONTROLLER_NAME | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment