import ngModule from '../module'; import Descriptor from 'salix/components/descriptor'; class Controller extends Descriptor { get travel() { return this.entity; } set travel(value) { this.entity = value; } loadData() { const filter = { fields: [ 'id', 'ref', 'shipped', 'landed', 'totalEntries', 'warehouseInFk', 'warehouseOutFk' ], include: [ { relation: 'warehouseIn', scope: { fields: ['name'] } }, { relation: 'warehouseOut', scope: { fields: ['name'] } } ] }; return this.getData(`Travels/${this.id}`, {filter}) .then(res => this.entity = res.data); } } ngModule.vnComponent('vnTravelDescriptor', { template: require('./index.html'), controller: Controller, bindings: { travel: '<' } });