I am looking to utilize the $q
function as part of the link function in my directive. The goal is to wrap any potential promises returned by one of the arguments (see example below). I'm unsure, however, how to pass the $q
dependency to this function.
angular.module('directives')
.directive('myDirective', function() {
return {
scope: {
onEvent: '&'
}
// ...
link: function($scope, $element) {
$scope.handleEvent() {
$q.when($scope.onEvent()) {
...
}
}
}
}
}