customer-list

This commit is contained in:
Javi Gallego 2016-10-07 11:56:48 +02:00
commit af097fde31
10 changed files with 56 additions and 24 deletions

View File

@ -2,5 +2,4 @@ import {bootstrap} from './bootstrap';
import * as spliting from './spliting';
import * as routes from './routes';
bootstrap();

View File

@ -1,6 +1,5 @@
import * as core from '@salix/core';
import * as spliting from './spliting';
// import {routes} from './fake';
function config($stateProvider, $urlRouterProvider) {
function loader($ocLazyLoad, $q) {
@ -12,13 +11,15 @@ function config($stateProvider, $urlRouterProvider) {
}
$urlRouterProvider.otherwise("/");
$stateProvider.state("index", {
url: '/index',
template: '<customer-index></customer-index>',
resolve: {
loader: loader
}
});
}
routes.forEach(function(route) {
$stateProvider.state(route.state, {
url: route.url,
template :route.template,
resolve: {
loader: xxx(route)
}
})
}, this);
});
core.module.config(config);

View File

@ -1,4 +0,0 @@
{
"route": "buys",
"template": "buys.template"
}

View File

@ -1,11 +1,15 @@
/**
* export public module
*/
export * from './module'
export * from './util'
export {SplitingRegister as splitingRegister} from './splitingregister'
export {NAME as RESOLVEDEFAULTCOMPONENT, ResolveDefaultComponent} from './resolveDefaultComponents'
export {NAME as INTERPOLATE,Interpolate} from './interpolate'
export {NAME as ROUTESLOADER, RoutesLoader} from './routesLoader'
export {NAME as BUTTON,directive as ButtonDirective} from './button/button'
export {NAME as BUTTONMT,factory as buttonmt} from './button/button.mt'
export {NAME as BUTTONBT,factory as buttonbt} from './button/button.bt'
@ -20,4 +24,4 @@ export {NAME as TEXTFIELDMT,factory as textfieldmt} from './textfield/textfield.
export {NAME as TEXTFIELDBT,factory as textfieldbt} from './textfield/textfield.bt'
export {NAME as LABEL,directive as LabelDirective} from './label/label'
export {NAME as LABELMT,factory as labelmt} from './label/label.mt'
export {NAME as LABELBT,factory as labelbt} from './label/label.bt'
export {NAME as LABELBT,factory as labelbt} from './label/label.bt'

View File

@ -0,0 +1,29 @@
import {module as _module} from './module'
import * as util from './util'
export const NAME = util.getProviderName ('RoutesLoader')
export class RoutesLoader
{
constructor () {}
$get ($http)
{
let script = document.currentScript || (() => {
let scripts = document.getElementsByTagName ('script');
return scripts[scripts.length - 1];
}) ();
let routesCdn = script.getAttribute ('routes-cdn');
return $http
({
method: 'GET',
url: routesCdn
})
}
}
_module.provider (NAME, () => new RoutesLoader ())

View File

@ -1,4 +0,0 @@
{
"route": "sales",
"template": "sales.template"
}

View File

@ -9,7 +9,7 @@ function combineFunc (data)
gulp.task ('default', function ()
{
var json = gulp.src ('./@salix/**/routing.json')
var json = gulp.src ('./@salix/**/routes.json')
.pipe (jsoncombine ('salix.routes.json', combineFunc))
.pipe (gulp.dest ('./build'));
});

View File

@ -11,6 +11,11 @@
<a ui-sref="edit">edit</a>
<a ui-sref="delete">delete</a>
</div>
<script type="text/javascript" src="build/salix.app.js" selector="#app"></script>
<script
type="text/javascript"
src="build/salix.app.js"
selector="#app"
routes-cdn="http://localhost:8080/routes">
</script>
</body>
</html>

View File

@ -11,6 +11,7 @@
"dependencies": {
"angular": "^1.5.8",
"angular-ui-router": "^1.0.0-beta.3",
"cors": "^2.8.1",
"express": "^4.14.0",
"material-design-lite": "^1.2.1",
"oclazyload": "^0.6.3"

View File

@ -1,5 +1,6 @@
var express = require ('express');
var cors = require ('cors');
function getRoutes (req, res)
{
@ -18,7 +19,7 @@ function onListen ()
}
var app = express ();
app.get ('/routes.json', getRoutes);
app.all (/.*/, getDefault);
app.get ('/routes', cors (), getRoutes);
app.all (/.*/, cors (), getDefault);
app.listen (8080, onListen);