CaffGeek/MBACNationals

View on GitHub
Web.Admin/AdminApp/Directives/directive.converttonumber.js

Summary

Maintainability
A
0 mins
Test Coverage
app.directive('convertToNumber', function () {
    return {
        require: 'ngModel',
        link: function (scope, element, attrs, ngModel) {
            ngModel.$parsers.push(function (val) {
                return val ? parseInt(val, 10) : null;
            });
            ngModel.$formatters.push(function (val) {
                return val ? '' + val : null;
            });
        }
    };
});