【发布时间】:2016-09-04 22:12:11
【问题描述】:
查看:
<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); ?>
请查看我附加的输出,它显示了那些与查询不匹配的标签,我只想显示匹配的标签
【问题讨论】:
-
发布您的代码,以便我们为您提供帮助。
-
请再次阅读我的问题,我添加了代码