zettapi_client
Version:
Admin panel and client-side CRUD operations in angular to use with zettapi_server rest api to get started quickly in any CMS project.
17 lines • 509 B
JavaScript
app.directive('asInteger', function() {
return {
require: '^ngModel',
restrict: 'A',
link: function(scope, element, attrs, ctrl) {
ctrl.$formatters.splice(0, ctrl.$formatters.length);
ctrl.$parsers.splice(0, ctrl.$parsers.length);
ctrl.$formatters.push(function(modelValue) {
if (typeof modelValue === 'undefined') return;
return parseInt(modelValue);
});
ctrl.$parsers.push(function(modelValue) {
return modelValue;
});
}
};
});