1
入力テキストに自動補完機能を持つデータリストを使用しています。 私はそれをうまく初期化しますが、ソースと私の提案を動的に更新したいと思います。ダイナミックオートコンプリートのデータリストを更新するには?
このような操作をお持ちですか?
HTML:
<input type="text" ng-model="title" list="suggestionList" ng-change="changeIsRaised()">
<datalist id="suggestionList">
<option data-ng-repeat="ttl in titles" value="{{ttl}}">
</datalist>
はJavaScript:
$scope.titles = ["Action Comics", "Detective Comics", "Superman", "Fantastic Four", "Amazing Spider-Man"];
$scope.changeIsRaised = function() {
if ($scope.title == "ch") {
var newSrc = ["john", "bill", "charlie", "robert", "alban", "oscar", "marie", "celine", "brad", "drew", "rebecca", "michel", "francis", "jean", "paul", "pierre", "nicolas", "alfred", "gerard", "louis", "albert", "edouard", "benoit", "guillaume", "nicolas", "joseph"];
$scope.titles = newSrc;
}
}
何をして動作していませんか?それはうまくいくように見えます。 – isherwood
いいえいいえ:( –