salix/client/ticket/src/card/ticket-card.js

36 lines
839 B
JavaScript
Raw Normal View History

2018-03-14 10:41:19 +00:00
import ngModule from '../module';
class TicketCard {
constructor($http, $state, $timeout) {
this.$http = $http;
this.$state = $state;
this.$timeout = $timeout;
this.ticket = null;
}
_getTicket() {
let filter = {
};
this.$http.get(`/ticket/api/Tickets/${this.$state.params.id}?filter=${JSON.stringify(filter)}`)
.then(res => {
if (res.data && res.data.id) {
this.$timeout(() => {
this.ticket = res.data;
});
}
}
);
}
$onInit() {
this._getTicket();
}
}
TicketCard.$inject = ['$http', '$state', '$timeout'];
ngModule.component('vnTicketCard', {
template: require('./ticket-card.html'),
controller: TicketCard
});