简体   繁体   中英

Why typeahead-on-select event firing?

I use the typeahead like this :

<input type="text" 
       id="UxSearchAddHoc{{$index}}"  
       placeholder="search" 
       class="form-control" 
       typeahead="f as f.label for f in formulaObjects | filter:$viewValue" 
       typeahead-on-select="selectedFormulaObject()"
       style="width: calc(100% - 45px);" 
       ng-change="getAddHocObjects($index)" 
       ng-model="formulaObject" />

and this is my on-select event :

$scope.selectedFormulaObject = function () {
    $timeout(function () {
        console.log(5);
    });
};

But this event does not fire when I select a value from the list selectedFormulaObject .

I added something like this :

typeahead-select-on-blur="true"

and its working now. I learned this => The blur event occurs when the field loses focus

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM