customer-list
This commit is contained in:
commit
af097fde31
|
@ -2,5 +2,4 @@ import {bootstrap} from './bootstrap';
|
||||||
import * as spliting from './spliting';
|
import * as spliting from './spliting';
|
||||||
import * as routes from './routes';
|
import * as routes from './routes';
|
||||||
|
|
||||||
|
|
||||||
bootstrap();
|
bootstrap();
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import * as core from '@salix/core';
|
import * as core from '@salix/core';
|
||||||
import * as spliting from './spliting';
|
import * as spliting from './spliting';
|
||||||
// import {routes} from './fake';
|
|
||||||
|
|
||||||
function config($stateProvider, $urlRouterProvider) {
|
function config($stateProvider, $urlRouterProvider) {
|
||||||
function loader($ocLazyLoad, $q) {
|
function loader($ocLazyLoad, $q) {
|
||||||
|
@ -12,13 +11,15 @@ function config($stateProvider, $urlRouterProvider) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$urlRouterProvider.otherwise("/");
|
$urlRouterProvider.otherwise("/");
|
||||||
$stateProvider.state("index", {
|
|
||||||
url: '/index',
|
|
||||||
template: '<customer-index></customer-index>',
|
|
||||||
resolve: {
|
|
||||||
loader: loader
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
core.module.config(config);
|
routes.forEach(function(route) {
|
||||||
|
$stateProvider.state(route.state, {
|
||||||
|
url: route.url,
|
||||||
|
template :route.template,
|
||||||
|
resolve: {
|
||||||
|
loader: xxx(route)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, this);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"route": "buys",
|
|
||||||
"template": "buys.template"
|
|
||||||
}
|
|
|
@ -1,11 +1,15 @@
|
||||||
/**
|
/**
|
||||||
* export public module
|
* export public module
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export * from './module'
|
export * from './module'
|
||||||
export * from './util'
|
export * from './util'
|
||||||
|
|
||||||
export {SplitingRegister as splitingRegister} from './splitingregister'
|
export {SplitingRegister as splitingRegister} from './splitingregister'
|
||||||
export {NAME as RESOLVEDEFAULTCOMPONENT, ResolveDefaultComponent} from './resolveDefaultComponents'
|
export {NAME as RESOLVEDEFAULTCOMPONENT, ResolveDefaultComponent} from './resolveDefaultComponents'
|
||||||
export {NAME as INTERPOLATE,Interpolate} from './interpolate'
|
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 BUTTON,directive as ButtonDirective} from './button/button'
|
||||||
export {NAME as BUTTONMT,factory as buttonmt} from './button/button.mt'
|
export {NAME as BUTTONMT,factory as buttonmt} from './button/button.mt'
|
||||||
export {NAME as BUTTONBT,factory as buttonbt} from './button/button.bt'
|
export {NAME as BUTTONBT,factory as buttonbt} from './button/button.bt'
|
||||||
|
|
|
@ -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 ())
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"route": "sales",
|
|
||||||
"template": "sales.template"
|
|
||||||
}
|
|
|
@ -9,7 +9,7 @@ function combineFunc (data)
|
||||||
|
|
||||||
gulp.task ('default', function ()
|
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 (jsoncombine ('salix.routes.json', combineFunc))
|
||||||
.pipe (gulp.dest ('./build'));
|
.pipe (gulp.dest ('./build'));
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,6 +11,11 @@
|
||||||
<a ui-sref="edit">edit</a>
|
<a ui-sref="edit">edit</a>
|
||||||
<a ui-sref="delete">delete</a>
|
<a ui-sref="delete">delete</a>
|
||||||
</div>
|
</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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"angular": "^1.5.8",
|
"angular": "^1.5.8",
|
||||||
"angular-ui-router": "^1.0.0-beta.3",
|
"angular-ui-router": "^1.0.0-beta.3",
|
||||||
|
"cors": "^2.8.1",
|
||||||
"express": "^4.14.0",
|
"express": "^4.14.0",
|
||||||
"material-design-lite": "^1.2.1",
|
"material-design-lite": "^1.2.1",
|
||||||
"oclazyload": "^0.6.3"
|
"oclazyload": "^0.6.3"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
|
||||||
var express = require ('express');
|
var express = require ('express');
|
||||||
|
var cors = require ('cors');
|
||||||
|
|
||||||
function getRoutes (req, res)
|
function getRoutes (req, res)
|
||||||
{
|
{
|
||||||
|
@ -18,7 +19,7 @@ function onListen ()
|
||||||
}
|
}
|
||||||
|
|
||||||
var app = express ();
|
var app = express ();
|
||||||
app.get ('/routes.json', getRoutes);
|
app.get ('/routes', cors (), getRoutes);
|
||||||
app.all (/.*/, getDefault);
|
app.all (/.*/, cors (), getDefault);
|
||||||
app.listen (8080, onListen);
|
app.listen (8080, onListen);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue