我想在我的Bootstrap輸入中使用Typeahead。我在$ scope.regions中獲取信息和存儲。這裏是我的代碼:Angular - 在輸入中使用typeahead
myfile.js:
$scope.selectedRegion = "";
$scope.regions = res.data.result;
,這裏是我的元素的截圖:
我想用regionName在輸入鍵盤緩衝。這裏是我的輸入HTML代碼:
<input placeholder="select region" class="form-control form-xs typeahead" ng-model="selectedRegion" typeahead="region for region in regions($viewValue)">
我要檢查regionName列表如下:
<li ng-repeat="region in regions">
<a href = "#"> {{ region.regionName }} </a>
</li>
</ul>
好吧,我可以看到列表的結果。但Typeahead不起作用,我的意思是沒有出現輸入框中的typeahead。任何建議?
用戶輸入在每次在myfile.js中都被清除$ http.get req uest。刪除$ scope.selectedRegion =「」;聲明。 – tejesh95
我刪除它,但它仍然不起作用 – AFN
更清楚地解釋什麼是不工作? – tejesh95