I need to use $q
a link
function of my directive. I need it to wrap possible promise that is retuned by one of arguments (see the example below). I don't know however, how to pass $q
dependency to a this function.
angular.module('directives')
.directive('myDirective', function() {
return {
scope: {
onEvent: '&'
}
// ...
link: function($scope, $element) {
$scope.handleEvent() {
$q.when($scope.onEvent()) {
...
}
}
}
}
}