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

33 lines
800 B
JavaScript
Raw Normal View History

2017-12-20 13:36:12 +00:00
import ngModule from '../module';
class ItemCard {
2017-12-21 13:09:55 +00:00
constructor($http, $state) {
this.$http = $http;
this.$state = $state;
2017-12-20 13:36:12 +00:00
this.item = {};
}
2017-12-21 13:09:55 +00:00
$onInit() {
let filter = {
include: [
{relation: "itemType"},
{relation: "origin"},
{relation: "ink"},
{relation: "producer"},
{relation: "intrastat"}
]
};
this.$http.get(`/item/api/Items/${this.$state.params.id}?filter=${JSON.stringify(filter)}`).then(
res => {
this.item = res.data;
}
);
}
2017-12-20 13:36:12 +00:00
}
2017-12-21 13:09:55 +00:00
ItemCard.$inject = ['$http', '$state'];
2017-12-20 13:36:12 +00:00
ngModule.component('vnItemCard', {
template: require('./item-card.html'),
controller: ItemCard
});