36 lines
839 B
JavaScript
36 lines
839 B
JavaScript
|
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
|
||
|
});
|