From c8dcf2b9712d44646328b8a2c51cf3c7aa79d22c Mon Sep 17 00:00:00 2001 From: Daniel Herrero Date: Thu, 30 Nov 2017 14:00:07 +0100 Subject: [PATCH] =?UTF-8?q?posibilidad=20de=20a=C3=B1adir=20paramateros=20?= =?UTF-8?q?a=20las=20rutas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/client/src/filterClientList.js | 1 + client/core/src/watcher/watcher.js | 4 ++-- client/salix/src/configroutes.js | 11 ++++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/client/client/src/filterClientList.js b/client/client/src/filterClientList.js index 908754b0f..3ad70cfc5 100644 --- a/client/client/src/filterClientList.js +++ b/client/client/src/filterClientList.js @@ -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; diff --git a/client/core/src/watcher/watcher.js b/client/core/src/watcher/watcher.js index 2dbc5a2bc..d259f6f39 100644 --- a/client/core/src/watcher/watcher.js +++ b/client/core/src/watcher/watcher.js @@ -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 || {}) ); } /** diff --git a/client/salix/src/configroutes.js b/client/salix/src/configroutes.js index 1d79c5bc2..e5ab72fb8 100644 --- a/client/salix/src/configroutes.js +++ b/client/salix/src/configroutes.js @@ -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)}>`, 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; }