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

Function numberFormatterParser

lib/test/angular/1.6.7/angular.js:25470–25487  ·  view source on GitHub ↗
(ctrl)

Source from the content-addressed store, hash-verified

25468}
25469
25470function numberFormatterParser(ctrl) {
25471 ctrl.$$parserName = 'number';
25472 ctrl.$parsers.push(function(value) {
25473 if (ctrl.$isEmpty(value)) return null;
25474 if (NUMBER_REGEXP.test(value)) return parseFloat(value);
25475 return undefined;
25476 });
25477
25478 ctrl.$formatters.push(function(value) {
25479 if (!ctrl.$isEmpty(value)) {
25480 if (!isNumber(value)) {
25481 throw ngModelMinErr('numfmt', 'Expected `{0}` to be a number', value);
25482 }
25483 value = value.toString();
25484 }
25485 return value;
25486 });
25487}
25488
25489function parseNumberAttrVal(val) {
25490 if (isDefined(val) && !isNumber(val)) {

Callers 2

numberInputTypeFunction · 0.70
rangeInputTypeFunction · 0.70

Calls 1

isNumberFunction · 0.70

Tested by

no test coverage detected