看法:
<div class="row" ng-controller="TagsInputController">
<tags-input ng-model="tags">
<auto-complete source="queryTags($query)" min-length="1"></auto-complete>
</tags-input>
</div>
控制器:
myApp.controller('TagsInputController',['$scope','$timeout','$http',function($scope,$timeout,$http){
$scope.tags = [
{ text: 'Tag1' },
{ text: 'Tag2' },
{ text: 'Tag3' }
];
$scope.queryTags=function($query){
return $http.get('tags.php',{
params:{
'tag':$query
}
})
}
}]);
php:tags.php
<?php
$names=array(
'palash',
'kailash',
'kuldeep'
);
echo json_encode($names); ?>
请查看我附加的输出,它显示了那些与查询不匹配的标签,我只想显示哪些匹配