export default function IntegerDirective() {
  return {
    restrict: 'A',
    require: 'ngModel',
    link(scope, elem, attrs, ngModel) {
      if (attrs.wsInteger === 'true') {
        ngModel.$formatters.push(value => parseInt(value, 10));

        ngModel.$parsers.push(value => parseInt(value, 10));
      }
    },
  };
}
