(ctrl)
| 25849 | } |
| 25850 | |
| 25851 | function numberFormatterParser(ctrl) { |
| 25852 | ctrl.$$parserName = 'number'; |
| 25853 | ctrl.$parsers.push(function(value) { |
| 25854 | if (ctrl.$isEmpty(value)) return null; |
| 25855 | if (NUMBER_REGEXP.test(value)) return parseFloat(value); |
| 25856 | return undefined; |
| 25857 | }); |
| 25858 | |
| 25859 | ctrl.$formatters.push(function(value) { |
| 25860 | if (!ctrl.$isEmpty(value)) { |
| 25861 | if (!isNumber(value)) { |
| 25862 | throw ngModelMinErr('numfmt', 'Expected `{0}` to be a number', value); |
| 25863 | } |
| 25864 | value = value.toString(); |
| 25865 | } |
| 25866 | return value; |
| 25867 | }); |
| 25868 | } |
| 25869 | |
| 25870 | function parseNumberAttrVal(val) { |
| 25871 | if (isDefined(val) && !isNumber(val)) { |
no test coverage detected