posibilidad de añadir paramateros a las rutas
This commit is contained in:
parent
7d32f95c23
commit
c8dcf2b971
|
@ -2,6 +2,7 @@ export default class FilterClientList {
|
||||||
constructor($scope, $timeout, $state) {
|
constructor($scope, $timeout, $state) {
|
||||||
this.$ = $scope;
|
this.$ = $scope;
|
||||||
this.$timeout = $timeout;
|
this.$timeout = $timeout;
|
||||||
|
this.$state = $state;
|
||||||
|
|
||||||
this.waitingMgCrud = 0;
|
this.waitingMgCrud = 0;
|
||||||
this.clientFk = $state.params.id;
|
this.clientFk = $state.params.id;
|
||||||
|
|
|
@ -68,9 +68,9 @@ export default class Watcher extends Component {
|
||||||
*
|
*
|
||||||
* @param {String} state The state name
|
* @param {String} state The state name
|
||||||
*/
|
*/
|
||||||
submitGo(state) {
|
submitGo(state, params) {
|
||||||
return this.submit().then(
|
return this.submit().then(
|
||||||
() => this.$state.go(state)
|
() => this.$state.go(state, params || {})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -47,9 +47,8 @@ function config($stateProvider, $urlRouterProvider, aclServiceProvider, modulesF
|
||||||
for (let i = 0; i < count; i++) {
|
for (let i = 0; i < count; i++) {
|
||||||
let route = fileRoutes[i];
|
let route = fileRoutes[i];
|
||||||
if (aclService.routeHasPermission(route)) {
|
if (aclService.routeHasPermission(route)) {
|
||||||
$stateProvider.state(route.state, {
|
let configRoute = {
|
||||||
url: route.url,
|
url: route.url,
|
||||||
abstract: route.abstract || false,
|
|
||||||
template: `<${route.component} ${getParams(route)}></${route.component}>`,
|
template: `<${route.component} ${getParams(route)}></${route.component}>`,
|
||||||
resolve: {
|
resolve: {
|
||||||
loader: loader(moduleName, validations)
|
loader: loader(moduleName, validations)
|
||||||
|
@ -57,7 +56,13 @@ function config($stateProvider, $urlRouterProvider, aclServiceProvider, modulesF
|
||||||
data: {
|
data: {
|
||||||
routes: fileRoutes
|
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) {
|
} else if (route.state === mainModule.state) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue