filter contact list
This commit is contained in:
parent
f28b14a9d9
commit
cdd8628cfe
2 changed files with 15 additions and 16 deletions
|
|
@ -4,25 +4,12 @@
|
|||
|
||||
<label class="item item-input">
|
||||
<i class="icon ion-search placeholder-icon"></i>
|
||||
<input type="text" placeholder="Search">
|
||||
<input type="text" placeholder="Search" ng-model="search" ng-change="findContact()">
|
||||
</label>
|
||||
|
||||
<h2>Contacts</h2>
|
||||
|
||||
<div class="list card">
|
||||
<!-- <a class="item item-icon-left" ng-repeat="contact in contactList" ng-click="openInputAmountModal(contact)">
|
||||
<i class="icon ion-ios-person-outline"></i>
|
||||
{{contact.label}}
|
||||
</a>
|
||||
|
||||
<a class="item item-icon-left" ng-repeat="wallet in wallets" ng-click="openInputAmountModal(wallet)">
|
||||
<i class="icon icon-wallet size-21" ng-style="{'color':wallet.color}"></i>
|
||||
{{wallet.name || wallet.alias}}
|
||||
<span class="item-note">
|
||||
{{wallet.balance || '123,999.91 bits'}}
|
||||
</span>
|
||||
</a> -->
|
||||
|
||||
<a class="item item-icon-left" ng-repeat="item in list" ng-click="openInputAmountModal(item)">
|
||||
<div ng-show="!item.id">
|
||||
<i class="icon ion-ios-person-outline"></i>
|
||||
|
|
@ -38,6 +25,5 @@
|
|||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</ion-content>
|
||||
</ion-view>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('tabSendController', function($scope, $ionicModal, addressbookService, profileService, configService, lodash) {
|
||||
var completeList;
|
||||
|
||||
$scope.init = function() {
|
||||
addressbookService.list(function(err, ab) {
|
||||
|
|
@ -41,7 +42,19 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
|||
});
|
||||
|
||||
$scope.wallets = lodash.sortBy(ret, 'name');
|
||||
$scope.list = $scope.contactList.concat($scope.wallets);
|
||||
$scope.list = completeList = $scope.contactList.concat($scope.wallets);
|
||||
};
|
||||
|
||||
$scope.findContact = function() {
|
||||
var result = lodash.filter($scope.list, function(item) {
|
||||
var val = item.label || item.alias || item.name;
|
||||
return lodash.includes(val.toLowerCase(), $scope.search.toLowerCase());
|
||||
});
|
||||
if (lodash.isEmpty(result) || lodash.isEmpty($scope.search)) {
|
||||
$scope.list = completeList;
|
||||
return;
|
||||
}
|
||||
$scope.list = result;
|
||||
};
|
||||
|
||||
$scope.openInputAmountModal = function(recipient) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue