MCPcopy Create free account
hub / github.com/angular-ui/ui-grid / numberFormatterParser

Function numberFormatterParser

lib/test/angular/1.7.0/angular.js:26007–26025  ·  view source on GitHub ↗
(ctrl)

Source from the content-addressed store, hash-verified

26005}
26006
26007function numberFormatterParser(ctrl) {
26008 ctrl.$parsers.push(function(value) {
26009 if (ctrl.$isEmpty(value)) return null;
26010 if (NUMBER_REGEXP.test(value)) return parseFloat(value);
26011
26012 ctrl.$$parserName = 'number';
26013 return undefined;
26014 });
26015
26016 ctrl.$formatters.push(function(value) {
26017 if (!ctrl.$isEmpty(value)) {
26018 if (!isNumber(value)) {
26019 throw ngModelMinErr('numfmt', 'Expected `{0}` to be a number', value);
26020 }
26021 value = value.toString();
26022 }
26023 return value;
26024 });
26025}
26026
26027function parseNumberAttrVal(val) {
26028 if (isDefined(val) && !isNumber(val)) {

Callers 2

numberInputTypeFunction · 0.70
rangeInputTypeFunction · 0.70

Calls 1

isNumberFunction · 0.70

Tested by

no test coverage detected