Navegación entre rutas

parte del inject
This commit is contained in:
nelo 2016-12-07 14:59:21 +01:00
parent b82e8941f4
commit ab0b9aee33
15 changed files with 67 additions and 12 deletions

View File

@ -34,4 +34,5 @@ function config($stateProvider, $urlRouterProvider) {
} }
} }
config.$inject = ['$stateProvider', '$urlRouterProvider'];
core.module.config(config); core.module.config(config);

View File

@ -197,4 +197,6 @@ export class Interpolate
} }
} }
module.provider(NAME, () => new Interpolate()); var interpolate = new Interpolate();
interpolate.$get.$inject = ['$parse', '$exceptionHandler', '$sce'];
module.provider(NAME, () => interpolate);

View File

@ -32,4 +32,6 @@ export class ResolveDefaultComponent {
} }
} }
_module.provider(NAME,() => new ResolveDefaultComponent()); var resolve = new ResolveDefaultComponent();
resolve.$get.$inject = ['$injector', 'vnInterpolate'];
_module.provider(NAME,() => resolve);

View File

@ -25,5 +25,7 @@ export class RoutesLoader
} }
} }
_module.provider (NAME, () => new RoutesLoader ()) var routes = new RoutesLoader ();
routes.$get.$inject = ['$http'];
_module.provider (NAME, () => routes)

View File

@ -27,4 +27,5 @@ export const COMPONENT = {
}); });
}, },
}; };
COMPONENT.controller.$inject = ['$http'];
module.component(NAME, COMPONENT); module.component(NAME, COMPONENT);

View File

@ -13,4 +13,5 @@ export const COMPONENT = {
}; };
} }
}; };
COMPONENT.controller.$inject = ['$http'];
module.component(NAME, COMPONENT); module.component(NAME, COMPONENT);

View File

@ -6,10 +6,16 @@ const _NAME = 'clientClient';
export const NAME = "vnClientCard"; export const NAME = "vnClientCard";
export const COMPONENT = { export const COMPONENT = {
template: template, template: template,
controller: function() { controller: function($http, $stateParams) {
let clientRoutes = routes['src/client/routes.js'].routes; let clientRoutes = routes['src/client/routes.js'].routes;
this.client = [];
this.items = []; this.items = [];
$http.get(`/client/api/Clients/${$stateParams.id}`).then(
(json) => {this.client = json.data;},
(json) => console.error (json.data.error.message)
);
clientRoutes.forEach ((i) => { clientRoutes.forEach ((i) => {
if (i.description) if (i.description)
this.items.push ({ this.items.push ({
@ -26,5 +32,5 @@ export const COMPONENT = {
}; };
} }
}; };
COMPONENT.controller.$inject = ['$http', '$stateParams'];
module.component(NAME, COMPONENT); module.component(NAME, COMPONENT);

View File

@ -16,3 +16,5 @@ export {NAME as CLIENT_NOTES,
COMPONENT as CLIENT_NOTES_COMPONENT} from './notes/index'; COMPONENT as CLIENT_NOTES_COMPONENT} from './notes/index';
export {NAME as CLIENT_SEARCH_PANEL, export {NAME as CLIENT_SEARCH_PANEL,
COMPONENT as CLIENT_SEARCH_PANEL_COMPONENT} from './search-panel/search-panel'; COMPONENT as CLIENT_SEARCH_PANEL_COMPONENT} from './search-panel/search-panel';
export {NAME as CLIENT_ITEM,
COMPONENT as CLIENT_ITEM_COMPONENT} from './index/item-client';

View File

@ -13,5 +13,6 @@ export const COMPONENT = {
}; };
} }
}; };
COMPONENT.controller.$inject = ['$http'];
module.component(NAME, COMPONENT); module.component(NAME, COMPONENT);

View File

@ -1,4 +1,3 @@
<form ng-submit="$ctrl.submit()">
<vn-vertical class="full-height"> <vn-vertical class="full-height">
<vn-topbar></vn-topbar> <vn-topbar></vn-topbar>
<vn-horizontal> <vn-horizontal>
@ -6,6 +5,12 @@
<vn-searchbar vn-four id="searchbar"></vn-searchbar> <vn-searchbar vn-four id="searchbar"></vn-searchbar>
<vn-search-panel ></vn-search-panel> <vn-search-panel ></vn-search-panel>
<vn-four></vn-four> <vn-four></vn-four>
</vn-horizontal> </vn-horizontal>
</vn-vertical> <vn-horizontal>
</form> <vn-three></vn-three>
<vn-vertical>
<vn-item-client ng-repeat="client in $ctrl.clients" client = "client" vn-six></vn-item-client>
</vn-vertical>
<vn-three></vn-three>
</vn-horizontal>
</vn-vertical>

View File

@ -5,9 +5,16 @@ export const NAME = "vnClientIndex";
export const COMPONENT = { export const COMPONENT = {
template: template, template: template,
controller: function($http) { controller: function($http) {
this.clients = [];
$http.get('/client/api/Clients').then(
(json) => {this.clients = json.data; },
(json) => console.error (json.data.error.message)
);
this.submit = function() { this.submit = function() {
var query = {where: this.model, fields: {id: true}}; var query = {where: this.model, fields: {id: true}};
console.log(query);
$http.get(`/client/api/Clients/findOne?filter=${JSON.stringify(query)}`).then( $http.get(`/client/api/Clients/findOne?filter=${JSON.stringify(query)}`).then(
function(response) { function(response) {
console.log(response); console.log(response);
@ -19,5 +26,5 @@ export const COMPONENT = {
}; };
} }
}; };
//COMPONENT.controller.$inject = ['$http']; COMPONENT.controller.$inject = ['$http'];
module.component(NAME, COMPONENT); module.component(NAME, COMPONENT);

View File

@ -0,0 +1,12 @@
<vn-auto style="border-radius: .5em;" >
<vn-horizontal style="align-items: center;">
<vn-auto>
<div><b>{{$ctrl.client.alias}}</b></div>
<div>{{$ctrl.client.name}}</div>
<div>{{$ctrl.client.phone}}, {{$ctrl.client.contact}}</div>
</vn-auto>
<vn-empty>
<a ui-sref="clientCard.basicData({ id: {{$ctrl.client.id}} })"><vn-icon-button icon="edit" ></vn-icon-button></a>
</vn-empty>
</vn-horizontal>
</vn-auto>

View File

@ -0,0 +1,11 @@
import template from './item-client.html';
import {module} from '../../module';
export const NAME = 'vnItemClient';
export const COMPONENT = {
template: template,
bindings: {
client: '<'
}
};
module.component(NAME, COMPONENT);

View File

@ -78,6 +78,7 @@ export const COMPONENT =
controllerAs: 'login' controllerAs: 'login'
}; };
COMPONENT.controller.$inject = ['$http'];
module.component('vnLogin', COMPONENT); module.component('vnLogin', COMPONENT);
module.config(['$httpProvider', function($httpProvider) { module.config(['$httpProvider', function($httpProvider) {
$httpProvider.defaults.useXDomain = true; $httpProvider.defaults.useXDomain = true;

View File

@ -48,6 +48,7 @@ var config = {
'node_modules' 'node_modules'
] ]
}, },
plugins: [],
devtool: 'source-map' devtool: 'source-map'
}; };