posibilidad de añadir paramateros a las rutas

This commit is contained in:
Daniel Herrero 2017-11-30 14:00:07 +01:00
parent 7d32f95c23
commit c8dcf2b971
3 changed files with 11 additions and 5 deletions

View File

@ -2,6 +2,7 @@ export default class FilterClientList {
constructor($scope, $timeout, $state) {
this.$ = $scope;
this.$timeout = $timeout;
this.$state = $state;
this.waitingMgCrud = 0;
this.clientFk = $state.params.id;

View File

@ -68,9 +68,9 @@ export default class Watcher extends Component {
*
* @param {String} state The state name
*/
submitGo(state) {
submitGo(state, params) {
return this.submit().then(
() => this.$state.go(state)
() => this.$state.go(state, params || {})
);
}
/**

View File

@ -47,9 +47,8 @@ function config($stateProvider, $urlRouterProvider, aclServiceProvider, modulesF
for (let i = 0; i < count; i++) {
let route = fileRoutes[i];
if (aclService.routeHasPermission(route)) {
$stateProvider.state(route.state, {
let configRoute = {
url: route.url,
abstract: route.abstract || false,
template: `<${route.component} ${getParams(route)}></${route.component}>`,
resolve: {
loader: loader(moduleName, validations)
@ -57,7 +56,13 @@ function config($stateProvider, $urlRouterProvider, aclServiceProvider, modulesF
data: {
routes: fileRoutes
}
});
};
if (route.abstract)
configRoute.abstract = true;
if (route.routeParams)
configRoute.params = route.routeParams;
$stateProvider.state(route.state, configRoute);
} else if (route.state === mainModule.state) {
break;
}