import ngModule from '../module'; export default class Controller { constructor($, $state) { this.$state = $state; Object.assign(this, { $, selectedWorker: null, }); this.moreOptions = [ {callback: () => this.$state.go('worker.department'), name: 'Departments'} ]; } onSearch(params) { if (params) this.$.model.applyFilter(null, params); else this.$.model.clear(); } preview(event, worker) { if (event.defaultPrevented) return; event.preventDefault(); this.selectedWorker = worker; this.$.preview.show(); event.stopImmediatePropagation(); } onMoreChange(callback) { callback.call(this); } } Controller.$inject = ['$scope', '$state']; ngModule.component('vnWorkerIndex', { template: require('./index.html'), controller: Controller });