ng-focus on md-autocomplete
When focus set to md-autocomplete, ng-focus function not call.
Same issue applies to ng-blur as well.
+1
Perhaps the ng-onblur on md-autocomplete have to be $eval on ng-onblur of internal input.
Actually the internal input have ng-blur="$mdAutocompleteCtrl.blur()"
Te same for ng-focus.
Bumping this to 0.12 since more users have been asking for it and it should be relatively straightforward to implement.
+1
A simple modification to the autocompleteDirective and autocomepleteController to expose a directive attribute, something like md-focus and md-blur would allow consumer controllers to operate on those events. as @tolemac pointed out, the internal input already has ng-focus and ng-blur implemented. Hooking in attribute expressions using $parse should be quite simple to implement.
I have a standing PR in https://github.com/angular-ui/ui-select that does something similar: https://github.com/angular-ui/ui-select/pull/1153
+1 for md-blur on md-autocomplete
+1
+1
+1!
+1
+1
+1
+1
+1
+1
+1
What I did to still have an "onBlur" event fired:
Created a directive called "autocompleteBlur", the $timeout is important, otherwise the input textbox isn't rendered at that time.
allocateApp.directive('autocompleteBlur', function($timeout){
return{
link: function(scope, element, attrs){
$timeout(clearInputBoxOnBlur, 0);
function clearInputBoxOnBlur(){
element.find("#autocomplete-input-id").bind("blur", function(){
angular.element(this).val('');
});
}
}
}
});
Then on the md-autocomplete element, add the newly created directive, and give an id to your input textbox (mine is called "autocomplete-input-id"):
<md-autocomplete
(...)
autocomplete-blur
md-input-id="autocomplete-input-id">
(...)
</md-autocomplete>
+1
+1
+1
+1
+1