zettapi_client
Version:
Client side CRUD operations in angular to use with zettapi_server rest api to get started quickly in any CMS project
20 lines (19 loc) • 514 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 (!modelValue) {
return;
}
return parseInt(modelValue);
});
ctrl.$parsers.push(function (modelValue) {
return modelValue;
});
}
};
});