Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use ng-blur on md-autocomplete?

I want to use blur event on md-autocomplete but both ng-blur and md-blur not working.

$scope.unFocus = function () {
            alert('Hello!');
        }
<md-autocomplete md-no-cache="false" md-selected-item="selectedItem" md-search-text-change="searchLocation(searchText)"
                    md-search-text="searchText" md-items="item in searchResult" md-item-text="item.address"
                    md-selected-item-change="changeLocation(item)" md-min-length="0" md-floating-label="Your Address" ng-blur="unFocus()">
            <md-item-template>
                <span md-highlight-text="searchText" md-highlight-flags="^i">{{item.address}}</span>
            </md-item-template>
            <md-not-found>
                <i>Not Found {{searchText}}</i>
            </md-not-found>
</md-autocomplete>
like image 838
thanhbebi Avatar asked Oct 28 '15 02:10

thanhbebi


People also ask

How does ng blur work?

The ng-blur directive tells AngularJS what to do when an HTML element loses focus. The ng-blur directive from AngularJS will not override the element's original onblur event, both the ng-blur expression and the original onblur event will be executed.

What is a blur event Angular?

A blur event fires when an element has lost focus. Note: As the blur event is executed synchronously also during DOM manipulations (e.g. removing a focussed input), AngularJS executes the expression using scope. $evalAsync if the event is fired during an $apply to ensure a consistent state.


1 Answers

ngBlur and ngFocus will start working from 1.1.1 version of Angular Material

like image 167
Сергій Талашко Avatar answered Nov 02 '22 07:11

Сергій Талашко