angular - HTML input type number doesn't work in edge -
i developing angular1 application , have input type number.
<input type="number" name="min" ng-model="vm.item.min" ng-max="vm.item.max" required >
but not work:
i can enter string
i don't have arrows increase/decrease value.
how can fix without polyfills?
so it's bug both angularjs , edge, seen in discussion below: https://github.com/angular/angular.js/issues/15366
a snippet proposed fix problem oneself:
.directive('input', () => { if(currentbrowser!="edge") return {}; return { link: (scope, elem) => { if (elem[0].type === 'number') { elem.on('keydown', evt => { switch (evt.which) { case 38: // up_arrow case 40: // down_arrow scope.$evalasync(() => elem.triggerhandler('change')); break; } }); } } }; });
Comments
Post a Comment