import ngModule from '../module'; class Controller { constructor($http, $stateParams) { this.$http = $http; this.$stateParams = $stateParams; } $onInit() { this.getCard(); } getCard() { let filter = { include: { relation: 'agencyMode', scope: {fields: ['name']} } }; let json = encodeURIComponent(JSON.stringify(filter)); let query = `/agency/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 });