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

Function numberFormatterParser

test/angular/1.6/angular.js:25851–25868  ·  view source on GitHub ↗
(ctrl)

Source from the content-addressed store, hash-verified

25849}
25850
25851function 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
25870function parseNumberAttrVal(val) {
25871 if (isDefined(val) && !isNumber(val)) {

Callers 2

numberInputTypeFunction · 0.70
rangeInputTypeFunction · 0.70

Calls 1

isNumberFunction · 0.70

Tested by

no test coverage detected