I need some help to force execute an event from a directive before the event of the controller. My scenario is the next:
I have an input like that with a search method in my controller :
<input type="text" name="searchText"
required
data-ng-model="searchText"
data-ng-enter="search(searchText)" />
And a directive that register globally the keydown 13 ( ENTER key) which contains the next code:
$document.bind("keydown keypress", function(event) {
if (event.which === 13) {
//do something
}
}
If I place the cursor into the input and i press enter key, ng-enter is fired before the event of the global directive. There is some way to force execute directive event before controller?
I tried using priority for directive but wasn't the solution.
All help would be appreciatted.