I am attempting to utilize the code snippet found at http://jsfiddle.net/phaas/8jFpV/, but I keep encountering an issue with injecting $filter
// Custom directive for converting dates between different formats
app.directive('DateConverter', function($compile, $filter) {
return {
restrict: 'A',
require: 'ngModel',
link: function(scope, element, attr, ngModel) {
function fromUser(text) {
var value = $filter('date')(text, "yyyyMMdd");
return value;
}
function toUser(text) {
var value = $filter('date')(text, "short");
return value;
}
ngModel.$parsers.push(fromUser);
ngModel.$formatters.push(toUser);
}
};
});
angular.js:4387 Uncaught Error: [$injector:modulerr] at angular.js:38 at angular.js:4387 at m (angular.js:336) at g (angular.js:4348) at eb (angular.js:4274) at d (angular.js:1630) at Ac (angular.js:1651) at Zd (angular.js:1545) at angular.js:28361 at HTMLDocument.a (angular.js:2998)