mirror of
https://github.com/ansible/awx.git
synced 2026-01-19 21:51:26 -03:30
Add stringToNumber directive
This commit is contained in:
parent
368101812c
commit
342958ece3
@ -38,7 +38,7 @@ angular.module('AWDirectives', ['RestServices', 'Utilities'])
|
||||
};
|
||||
})
|
||||
|
||||
// caplitalize Add to any input field where the first letter of each
|
||||
// capitalize Add to any input field where the first letter of each
|
||||
// word should be capitalized. Use in place of css test-transform.
|
||||
// For some reason "text-transform: capitalize" in breadcrumbs
|
||||
// causes a break at each blank space. And of course,
|
||||
@ -65,6 +65,26 @@ angular.module('AWDirectives', ['RestServices', 'Utilities'])
|
||||
};
|
||||
})
|
||||
|
||||
// stringToNumber
|
||||
//
|
||||
// If your model does not contain actual numbers then this directive
|
||||
// will do the conversion in the ngModel $formatters and $parsers pipeline.
|
||||
//
|
||||
.directive('stringToNumber', function() {
|
||||
return {
|
||||
require: 'ngModel',
|
||||
restrict: 'A',
|
||||
link: function(scope, element, attrs, ngModel) {
|
||||
ngModel.$parsers.push(function(value) {
|
||||
return '' + value;
|
||||
});
|
||||
ngModel.$formatters.push(function(value) {
|
||||
return parseFloat(value);
|
||||
});
|
||||
}
|
||||
};
|
||||
})
|
||||
|
||||
// imageUpload
|
||||
//
|
||||
// Accepts image and returns base64 information with basic validation
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user