diff --git a/imports/ui/components/partiesSort/partiesSort.js b/imports/ui/components/partiesSort/partiesSort.js new file mode 100644 index 000000000..6ce584b47 --- /dev/null +++ b/imports/ui/components/partiesSort/partiesSort.js @@ -0,0 +1,36 @@ +import angular from 'angular'; +import angularMeteor from 'angular-meteor'; + +import template from './partiesSort.html'; + +class PartiesSort { + constructor($timeout) { + 'ngInject'; + + $timeout(() => this.changed()); + } + + changed() { + this.onChange({ + sort: { + [this.property]: parseInt(this.order) + } + }); + } +} + +const name = 'partiesSort'; + +// create a module +export default angular.module(name, [ + angularMeteor +]).component(name, { + template, + bindings: { + onChange: '&', + property: '@', + order: '@' + }, + controllerAs: name, + controller: PartiesSort +});