Prueba concepto rutas
This commit is contained in:
parent
54c91c3d9e
commit
301588e0ed
|
@ -4,31 +4,7 @@ export const graphRoutes = {
|
|||
url: '/index',
|
||||
state: 'index',
|
||||
template: '<customer-index></customer-index>',
|
||||
module: 'compras',
|
||||
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',
|
||||
module: 'crud',
|
||||
description: '',
|
||||
image: '',
|
||||
}
|
||||
|
|
|
@ -1,22 +1,24 @@
|
|||
import * as core from '@salix/core';
|
||||
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) => {
|
||||
core.splitingRegister.execute(route.module).then(function(dependencies){
|
||||
core.splitingRegister.execute(route.module).then(function (dependencies) {
|
||||
var array = dependencies.map((item) => { return { name: item } });
|
||||
resolve($ocLazyLoad.load(array));
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
function config($stateProvider, $urlRouterProvider) {
|
||||
core.splitingRegister.registerGraph(routes.graphRoutes.graphDependendies);
|
||||
|
||||
$urlRouterProvider.otherwise("/");
|
||||
|
||||
routes.graphRoutes.routes.forEach(function (route) {
|
||||
$stateProvider.state(route.state, {
|
||||
|
@ -27,5 +29,7 @@ core.module.config(function ($stateProvider, $urlRouterProvider) {
|
|||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
core.module.config(config);
|
||||
|
|
|
@ -26,3 +26,15 @@ export const 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);
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
url: '/index',
|
||||
state: 'index',
|
||||
template: '<customer-index></customer-index>',
|
||||
module: 'crud',
|
||||
description: '',
|
||||
image: '',
|
||||
}
|
Loading…
Reference in New Issue