One_Two,
вариант фильтрации
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script>
<script>
angular.module('myApp', []);
angular.module('myApp').controller('Ctrl', function($scope) {
$scope.users = [
{
fullname: 'Козлова Виктория Павловна'
},
{
fullname: 'Козлов Виктор Петрович'
},
{
fullname: 'Афанасьев Геннадий Сергеевич'
},
{
fullname: 'Козлова Виктория Сергеевна'
}
];
$scope.advs = [];
$scope.currentAdv = {};
$scope.currentAdv.search = "";
$scope.currentAdv.queryType = "1";
$scope.addAdvSearch = function() {
var pattern = $scope.currentAdv.search, flags = "i", except = false;
if ($scope.currentAdv.queryType == 2) {flags = "";}
if ($scope.currentAdv.queryType == 3) {except = true;}
var reg = new RegExp(pattern, flags);
$scope.advs.push({reg:reg, except:except, search:pattern});
$scope.currentAdv.search = "";
$scope.currentAdv.queryType = "1";
};
$scope.advUserFilter = function(user) {
return $scope.advs.every(function(filter) {
return filter.except ^ filter.reg.test(user.fullname);
});
};
})
</script>
</head>
<body>
<div ng-app="myApp">
<div ng-controller="Ctrl">
<button ng-click="adv = ! adv">Добавить условие</button>
<div>
<ul ng-repeat="user in users | filter:advUserFilter">
<li>{{user.fullname}}</li>
</ul>
</div>
<div ng-show="adv">
<input type="text" ng-model="currentAdv.search" ng-init="search=''">
<input type="radio" name="query" ng-model="currentAdv.queryType" value="1" default>
<label for="query">Вхождение</label>
<input type="radio" name="query" ng-model="currentAdv.queryType" value="2">
<label for="query">Точное вхождение</label>
<input type="radio" name="query" ng-model="currentAdv.queryType" value="3">
<label for="query">Кроме</label>
<button ng-click="addAdvSearch()">Добавить</button><br>
<span>Добавленные фильтры</span>
<ul ng-repeat="adv in advs">
<li>{{adv.search}}</li>
</ul>
</div>
</div>
</div>
</body>
</html>