Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .controller('namesCtrl', ['$scope', '$rootScope', '$http', '$filter',
- function ($scope, $rootScope, $http, $filter) {
- $scope.names = $filter('orderBy')($scope.names, 'last_name', 'first_name');
- $scope.query = {}
- $scope.queryBy = '$'
- $scope.orderProp = "last_name";
- }])
- <ng-controller="namesCtrl">
- <table>
- <tr>
- <td align="right">Search </td>
- <td><input ng-model="query[queryBy]" /></td>
- </tr>
- </table>
- <div class="searchresults" ng-show="names.length" ng-repeat="name in names | orderBy : 'name.last_name' | filter:query as filtered">
- {{name.first_name}} {{name.last_name}}
- </div>
- </ng-controller>
- .searchresults {
- padding: 4px 8px;
- background-color: aliceblue;
- color: navy;
- font-size: 75%;
- position: relative;
- z-index: 20;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- border-radius: 5px;
- -moz-box-shadow: 0px 0px 4px #222;
- -webkit-box-shadow: 0px 0px 4px #222;
- box-shadow: 0px 0px 4px #222;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement