MCPcopy
hub / github.com/angular-ui/ui-router / numberFormatterParser

Function numberFormatterParser

test/angular/1.7/angular.js:26814–26832  ·  view source on GitHub ↗
(ctrl)

Source from the content-addressed store, hash-verified

26812}
26813
26814function numberFormatterParser(ctrl) {
26815 ctrl.$parsers.push(function(value) {
26816 if (ctrl.$isEmpty(value)) return null;
26817 if (NUMBER_REGEXP.test(value)) return parseFloat(value);
26818
26819 ctrl.$$parserName = 'number';
26820 return undefined;
26821 });
26822
26823 ctrl.$formatters.push(function(value) {
26824 if (!ctrl.$isEmpty(value)) {
26825 if (!isNumber(value)) {
26826 throw ngModelMinErr('numfmt', 'Expected `{0}` to be a number', value);
26827 }
26828 value = value.toString();
26829 }
26830 return value;
26831 });
26832}
26833
26834function parseNumberAttrVal(val) {
26835 if (isDefined(val) && !isNumber(val)) {

Callers 2

numberInputTypeFunction · 0.70
rangeInputTypeFunction · 0.70

Calls 1

isNumberFunction · 0.70

Tested by

no test coverage detected