import ngModule from '../module'; class Controller { constructor($scope, $http, $stateParams) { this.$stateParams = $stateParams; this.$scope = $scope; this.$http = $http; this.searchValue = ''; this.filter = {}; } onSearch() { this.$scope.$applyAsync(() => { this.$scope.treeview.refresh(); }); } exprBuilder(param, value) { switch (param) { case 'search': return {name: {like: `%${value}%`}}; } } onSelection(item) { const path = '/agency/api/ZoneIncludeds/toggleIsIncluded'; const params = {geoFk: item.id, zoneFk: this.zone.id}; this.$http.post(path, params).then(() => { this.$scope.treeview.repaintNode(item); }); } } Controller.$inject = ['$scope', '$http', '$stateParams']; ngModule.component('vnZoneLocation', { template: require('./index.html'), controller: Controller, bindings: { zone: '<' }, require: { card: '^vnZoneCard' } });