Prueba concepto rutas

This commit is contained in:
nelo 2016-10-07 12:51:31 +02:00
parent 54c91c3d9e
commit 301588e0ed
5 changed files with 41 additions and 41 deletions

View File

@ -4,31 +4,7 @@ export const graphRoutes = {
url: '/index', url: '/index',
state: 'index', state: 'index',
template: '<customer-index></customer-index>', template: '<customer-index></customer-index>',
module: 'compras', module: 'crud',
description: '',
image: '',
},
{
url: '/add',
state: 'add',
template: '<customer-add></customer-add>',
module: 'compras',
description: '',
image: '',
},
{
url: '/edit',
state: 'edit',
template: '<customer-edit></customer-edit>',
module: 'compras',
description: '',
image: '',
},
{
url: '/delete',
state: 'delete',
template: '<customer-delete></customer-delete>',
module: 'compras',
description: '', description: '',
image: '', image: '',
} }

View File

@ -1,11 +1,10 @@
import * as core from '@salix/core'; import * as core from '@salix/core';
import * as spliting from './spliting'; import * as spliting from './spliting';
import * as routes from './fake';
core.module.config(function ($stateProvider, $urlRouterProvider) {
core.splitingRegister.registerGraph(routes.graphRoutes.graphDependendies);
function loader(route) { function loader(route) {
return function loader($ocLazyLoad, $q) {
return function ($ocLazyLoad, $q) {
return $q((resolve) => { return $q((resolve) => {
core.splitingRegister.execute(route.module).then(function (dependencies) { core.splitingRegister.execute(route.module).then(function (dependencies) {
var array = dependencies.map((item) => { return { name: item } }); var array = dependencies.map((item) => { return { name: item } });
@ -13,10 +12,13 @@ core.module.config(function ($stateProvider, $urlRouterProvider) {
}); });
}); });
}); };
} }
$urlRouterProvider.otherwise("/"); function config($stateProvider, $urlRouterProvider) {
core.splitingRegister.registerGraph(routes.graphRoutes.graphDependendies);
routes.graphRoutes.routes.forEach(function (route) { routes.graphRoutes.routes.forEach(function (route) {
$stateProvider.state(route.state, { $stateProvider.state(route.state, {
@ -27,5 +29,7 @@ core.module.config(function ($stateProvider, $urlRouterProvider) {
} }
}) })
}); });
});
}
core.module.config(config);

View File

@ -26,3 +26,15 @@ export const pagos = () => {
}; };
core.splitingRegister.register('pagos', pagos); core.splitingRegister.register('pagos', pagos);
export const crud = () => {
return new Promise(resolve => {
require.ensure([], () => {
require('@salix/crud');
resolve('crud');
}, "salix.crud");
});
};
core.splitingRegister.register('crud', crud);

View File

@ -0,0 +1,8 @@
{
url: '/index',
state: 'index',
template: '<customer-index></customer-index>',
module: 'crud',
description: '',
image: '',
}

View File