angular模糊搜索

<div class="fa-search-box" ng-if="vagueSearchShow"><input class="yy-input yy-input-small w150" style="border:0px;box-shadow:none; outline:none" ng-change="vagueSearch(vague)" ng-model="vague" placeholder="搜索 关键字" /></div>
<div class="result-area-listline-body" scroller full-height ng-click="vagueSearchShowNo()">
<ul>
<li ng-repeat="btList in forlistCopyOne.list" ng-class="{'haveColor':btList.haveColor}"><a href="javascript:;" ng-click="toEventName(btList)" title="{{btList.eventName}}">{{btList.eventName}}</a></li>
<li ng-if="vagueSearchShowlist" style="color: #b7b9bb; font-style: italic;">无此数据</li>
</ul>
</div>

//模糊搜索
$scope.vagueSearchShow = false;
$scope.vagueSearchShowlist = false;
$scope.forlist = result.data;
$scope.forlistCopyOne = angular.copy($scope.forlist);
$scope.SearchToShow = function($event) {
if (window.event) {//IE
$event.cancelBubble=true;
} else { //FF
$event.stopPropagation();
};
$scope.vagueSearchShow = true;
$scope.vague='';
$(".result-area-listline .mCustomScrollbar").css('padding-bottom','30px');
};
$scope.vagueSearch = function(data) {
$scope.forlistCopyOne = angular.copy($scope.forlist);
if(data){
var vagueSearchList=$scope.forlistCopyOne.list;
var vagueSearchscore=[];
for (var i = 0; i < vagueSearchList.length; i++) {
if (vagueSearchList[i].eventName.indexOf(data)>=0) {
vagueSearchscore.push(vagueSearchList[i]);
}
}
$scope.forlistCopyOne.list=vagueSearchscore;
if($scope.forlistCopyOne.list.length==0){
$scope.vagueSearchShowlist = true;
}else{
$scope.vagueSearchShowlist = false;
}
}else{
$scope.vagueSearchShowlist = false;
}
};
$scope.vagueSearchShowNo = function() {
$scope.vagueSearchShow = false;
$(".result-area-listline .mCustomScrollbar").css('padding-bottom','0px');
};

转载于:https://www.cnblogs.com/xinweiqu/p/8241742.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值