import ngModule from '../module'; class ItemProduct { onClick(event) { if (event.defaultPrevented) event.stopImmediatePropagation(); } set item(value) { if (value) { let tags = []; for (let i = 5; i < 9; i++) { if (value['tag' + i]) { let tagValue = value['value' + i]; let tagKey = value['tag' + i]; tags.push({tag: {name: tagKey}, value: tagValue}); } } value.tags = tags; } this._item = value; } get item() { return this._item; } clone(event) { event.preventDefault(); this.index.cloneItem(this.item); } preview(event) { event.preventDefault(); this.index.showItemPreview(this.item); } } ngModule.component('vnItemProduct', { template: require('./product.html'), bindings: { item: '<' }, controller: ItemProduct, require: { index: '^vnItemIndex' } });