1
我試圖顯示帶自動填寫的標籤輸入字段,以便如果用戶在輸入字段中輸入一些文本,則可用標籤在下拉列表中顯示爲建議。一切工作正常至今:ngTagsInput/auto-complete(AngularJS)
<body ng-app="plunker" ng-controller="MainCtrl">
<tags-input ng-model="tags" add-on-paste="true">
<auto-complete source="loadTags($query)"></auto-complete>
</tags-input>
<p>Model: {{tags}}</p>
</body>
AngularJS代碼:
var app = angular.module('plunker', ['ngTagsInput']);
app.controller('MainCtrl', function($scope, $http) {
$scope.loadTags = function(query) {
return $http.get(Routing.generate('my_route_to_json_data'));
}
});
問題是,當我嘗試添加maxResultsToShow="4"
或minLength="1"
屬性,他們不沒有工作,我仍然得到相同的結果。
<body ng-app="plunker" ng-controller="MainCtrl">
<tags-input ng-model="tags" add-on-paste="true">
<auto-complete maxResultsToShow="4" loadOnEmpty=true minLength="1" source="loadTags($query)"></auto-complete>
</tags-input>
<p>Model: {{tags}}</p>
</body>
任何想法?