MCPcopy Index your code
hub / github.com/angular-ui/ui-router / numberFormatterParser

Function numberFormatterParser

test/angular/1.5/angular.js:24708–24725  ·  view source on GitHub ↗
(ctrl)

Source from the content-addressed store, hash-verified

24706}
24707
24708function 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
24727function parseNumberAttrVal(val) {
24728 if (isDefined(val) && !isNumber(val)) {

Callers 2

numberInputTypeFunction · 0.70
rangeInputTypeFunction · 0.70

Calls 1

isNumberFunction · 0.70

Tested by

no test coverage detected