import ngModule from '../module'; class Controller { constructor($http, $state) { this.$http = $http; this.$state = $state; this.filter = { include: [ {relation: 'worker', scope: {fields: ['name', 'firstName']}}, {relation: 'claimState', scope: {fields: ['id', 'description']}}, { relation: 'client', scope: { fields: ['salesPersonFk', 'name'], include: { relation: 'salesPerson', fields: ['firstName', 'name'] } } } ] }; } $onInit() { this.getCard(); } getCard() { let json = encodeURIComponent(JSON.stringify(this.filter)); let query = `/claim/api/Claims/${this.$state.params.id}?filter=${json}`; this.$http.get(query).then(res => { if (res.data) this.claim = res.data; }); } reload() { this.getCard(); } } Controller.$inject = ['$http', '$state']; ngModule.component('vnClaimCard', { template: require('./index.html'), controller: Controller });