angularjs - filters stopped working ..shows blank page -
when click headers, not sort , table disappears
angular.module('maniaapp') .controller('eventctrl', function ($scope,$location,$http) { $scope.sorttype = '_source.event_name'; // set default sort type $scope.sortreverse = false; // set default sort order $scope.searchevent = ''; // set default search/filter term var url = "http://api.loc/events/get-events"; $http.get(url).success(function api(data, status, headers, config){ $scope.events = data; }).error(function api(data, status, headers, config){ console.error(data, status, headers, config); });
here html
<div class="container"> <!--<div ng-view=""></div>--> <div ng-controller="eventctrl"> <div class="alert alert-info"> <p>sort type: {{ sorttype }}</p> <p>sort reverse: {{ sortreverse }}</p> <p>search query: {{ searchevent }}</p> </div> <form> <div class="form-group"> <div class="input-group"> <div class="input-group-addon"><i class="fa fa-search"></i></div> <input type="text" class="form-control" placeholder="search events" ng-model="searchevent"> </div> </div> </form> <table class="table table-bordered table-striped"> <thead> <tr> <td> <a href="#" ng-click="sorttype = '_source.id'; sortreverse = !sortreverse"> id <span ng-show="sorttype == '_source.id';" class="fa fa-caret-down"></span> </a> </td> <td> <a href="#" ng-click="sorttype = '_source.event_name'; sortreverse = !sortreverse"> <span ng-show="sorttype == '_source.event_name';" class="fa fa-caret-down"></span> event name </a> </td> <td> <a href="#" ng-click="sorttype = '_source.event_status_id'; sortreverse = !sortreverse"> <span ng-show="sorttype == '_source.event_sid'" class="fa fa-caret-down"></span> event status </a> </td> </tr> </thead> <tbody> <tr ng-repeat="event in events | orderby:sorttype:sortreverse | filter:searchevent"> <td>{{ event._source.event_id }}</td> <td>{{ event._source.event_name }}</td> <td>{{ event._source.event_sid }}</td> </tr> </tbody> </table> </div> </div>
Comments
Post a Comment