(ctrl)
| 24706 | } |
| 24707 | |
| 24708 | function numberFormatterParser(ctrl) { |
| 24709 | ctrl.$$parserName = 'number'; |
| 24710 | ctrl.$parsers.push(function(value) { |
| 24711 | if (ctrl.$isEmpty(value)) return null; |
| 24712 | if (NUMBER_REGEXP.test(value)) return parseFloat(value); |
| 24713 | return undefined; |
| 24714 | }); |
| 24715 | |
| 24716 | ctrl.$formatters.push(function(value) { |
| 24717 | if (!ctrl.$isEmpty(value)) { |
| 24718 | if (!isNumber(value)) { |
| 24719 | throw ngModelMinErr('numfmt', 'Expected `{0}` to be a number', value); |
| 24720 | } |
| 24721 | value = value.toString(); |
| 24722 | } |
| 24723 | return value; |
| 24724 | }); |
| 24725 | } |
| 24726 | |
| 24727 | function parseNumberAttrVal(val) { |
| 24728 | if (isDefined(val) && !isNumber(val)) { |
no test coverage detected