Skip to content

Instantly share code, notes, and snippets.

@felipemorais
Last active August 29, 2015 14:06
Show Gist options
  • Save felipemorais/879cfb275cbee7d1f7da to your computer and use it in GitHub Desktop.
Save felipemorais/879cfb275cbee7d1f7da to your computer and use it in GitHub Desktop.
Angularjs - rota dinamica
function capitalize(value) {
return value && value.charAt(0).toUpperCase() + value.substring(1);
}
$stateProvider.state('docs', {
url: '/:module/:file',
templateUrl: function ($stateParams){
return '../../../views/' + $stateParams.module + '/' + $stateParams.file + '.html';
},
controllerProvider: function($stateParams, $controller) {
return capitalize($stateParams.file) + 'Ctrl';
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment