35 lines
665 B
JavaScript
35 lines
665 B
JavaScript
|
import ngModule from '../module';
|
||
|
|
||
|
class Controller {
|
||
|
constructor($, $http) {
|
||
|
Object.assign(this, {
|
||
|
$,
|
||
|
$http
|
||
|
});
|
||
|
}
|
||
|
|
||
|
get worker() {
|
||
|
return this._worker;
|
||
|
}
|
||
|
|
||
|
set worker(value) {
|
||
|
this._worker = value;
|
||
|
this.$.worker = null;
|
||
|
if (value) {
|
||
|
this.$http.get(`api/Workers/${value.id}`).then(res => {
|
||
|
this.$.worker = res.data;
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Controller.$inject = ['$scope', '$http'];
|
||
|
|
||
|
ngModule.component('vnWorkerSummary', {
|
||
|
template: require('./index.html'),
|
||
|
controller: Controller,
|
||
|
bindings: {
|
||
|
worker: '<'
|
||
|
}
|
||
|
});
|