mirror of
https://github.com/ansible/awx.git
synced 2026-05-18 06:47:41 -02:30
Add stringToNumber directive
This commit is contained in:
committed by
Matthew Jones
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.
|
// word should be capitalized. Use in place of css test-transform.
|
||||||
// For some reason "text-transform: capitalize" in breadcrumbs
|
// For some reason "text-transform: capitalize" in breadcrumbs
|
||||||
// causes a break at each blank space. And of course,
|
// 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
|
// imageUpload
|
||||||
//
|
//
|
||||||
// Accepts image and returns base64 information with basic validation
|
// Accepts image and returns base64 information with basic validation
|
||||||
|
|||||||
Reference in New Issue
Block a user