一旦加载并渲染了角度引导typeahead,就使用回调

Using callback once the angular bootstrap typeahead is loaded and rendered

本文关键字:typeahead 回调 加载      更新时间:2023-09-26

我有以下html代码

<div id="myQuestion" class="col-sm-9" style="overflow-y: auto;height: 100%;">
    <span>
        <input type="text" style="overflow:auto" ng-model="selected" 
             typeahead="item for item in filterInput($viewValue) |   limitTo:10"
             typeahead-on-select='onSelect($item)'>                                                                     
    </span>
</div>

我想要一个回调函数,一旦typeahead被过滤并呈现到ui,类似于afterrender事件。我正在使用角度引导打字。我怎样才能做到这一点?

typeaheadrendered时,没有回调可检查。但是您可以使用viewContentLoaded事件进行此操作。

在您的控制器中侦听此事件:

$scope.$on('$viewContentLoaded', function(){
    //do your stuff here
}