javascript - Using Angular formatters / parsers -
can't seem angular formatters , parsers working: app.js: var itemapp = angular.module('itemapp', []); itemapp.controller('itemcontroller', ['$scope', function($scope) { $scope.some_value = 'abcefg'; }]); itemapp.directive('changecase', function () { return { restrict: 'a', require: 'ngmodel', link: function (scope, element, attrs, ngmodel) { ngmodel.$formatters.push(function(value){ return value.touppercase(); }); ngmodel.$parsers.push(function(value){ return value.tolowercase(); }); } }; }); view.html: <input ng-model="some_value" changecase> it doesn't work- no errors, nothing happens values in input or model. i'm newish angular, having trouble figuring out how i'd debug this. try write: <input ng-model="some_value" change