(ctrl)
| 25468 | } |
| 25469 | |
| 25470 | function numberFormatterParser(ctrl) { |
| 25471 | ctrl.$$parserName = 'number'; |
| 25472 | ctrl.$parsers.push(function(value) { |
| 25473 | if (ctrl.$isEmpty(value)) return null; |
| 25474 | if (NUMBER_REGEXP.test(value)) return parseFloat(value); |
| 25475 | return undefined; |
| 25476 | }); |
| 25477 | |
| 25478 | ctrl.$formatters.push(function(value) { |
| 25479 | if (!ctrl.$isEmpty(value)) { |
| 25480 | if (!isNumber(value)) { |
| 25481 | throw ngModelMinErr('numfmt', 'Expected `{0}` to be a number', value); |
| 25482 | } |
| 25483 | value = value.toString(); |
| 25484 | } |
| 25485 | return value; |
| 25486 | }); |
| 25487 | } |
| 25488 | |
| 25489 | function parseNumberAttrVal(val) { |
| 25490 | if (isDefined(val) && !isNumber(val)) { |
no test coverage detected