import ngModule from '../../module'; class Controller { constructor($http, $stateParams) { this.$http = $http; this.$stateParams = $stateParams; } $onInit() { this.getCard(); } getCard() { let filter = { include: [ {relation: 'warehouse', fields: ['name']}, {relation: 'agencyMode', fields: ['name']} ] }; let json = encodeURIComponent(JSON.stringify(filter)); let query = `/route/api/Zones/${this.$stateParams.id}?filter=${json}`; this.$http.get(query).then(res => { if (res.data) this.zone = res.data; }); } reload() { this.getCard(); } } Controller.$inject = ['$http', '$stateParams']; ngModule.component('vnZoneCard', { template: require('./index.html'), controller: Controller });