If you want to use DI with a directive (as I did), put the arguments to be injected in the directive factory function instead of the link function:
module.directive('name', function($timeout) {
return function(scope, element, attrs) {
...
};
});
To allow for minification, put the function argument in an array like you do for controllers:
module.directive('name', ['$timeout', function($timeout) {
return function(scope, element, attrs) {
...
};
}]);
See the current time example in the docs.
Edit: See here for a demo that injects the $timeout
service. You can do the same thing when returning a directive (e.g. return {restrict: 'E', link: function() {...}}
) object instead of a function.