Advertisement
Guest User

Untitled

a guest
Aug 5th, 2015
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. <div data-ng-repeat="cust in customers">
  2. <input type="checkbox" data-ng-model="search.city" data-ng-true-value="{{ cust.city }}" data-ng-false-value=""/> {{ cust.city }}
  3. </div>
  4.  
  5. <table>
  6.  
  7. <!-- table heading goes here -->
  8.  
  9. <tbody>
  10. <tr data-ng-repeat="customer in customers | filter : search">
  11. <td >
  12. {{ customer.firstName }}
  13. </td>
  14. <td >
  15. {{ customer.lastName }}
  16. </td>
  17. <td >
  18. {{ customer.address }}
  19. </td>
  20. <td >
  21. {{ customer.city }}
  22. </td>
  23. </tr>
  24. </tbody>
  25. </table>
  26.  
  27. <input type="checkbox" ng-model="search[cust.city]" /> {{ cust.city }}
  28.  
  29. <tr data-ng-repeat="customer in customers | filter:searchBy() ">
  30.  
  31. function ctrl($scope) {
  32. $scope.customers = [...];
  33.  
  34. $scope.search = {};
  35. $scope.searchBy = function () {
  36. return function (customer) {
  37. if ( $scope.search[customer.city] === true ) {
  38. return true;
  39. }
  40. }
  41. };
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement