salix/modules/worker/front/card/index.js

29 lines
564 B
JavaScript
Raw Normal View History

2019-01-28 15:24:45 +00:00
import ngModule from '../module';
class Controller {
constructor($http, $stateParams) {
Object.assign(this, {
$http,
$stateParams,
});
}
$onInit() {
this.reload();
}
reload() {
let query = `api/Workers/${this.$stateParams.id}`;
this.$http.get(query).then(res => {
this.worker = res.data;
});
}
}
Controller.$inject = ['$http', '$stateParams'];
ngModule.component('vnWorkerCard', {
template: require('./index.html'),
controller: Controller
});