Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- search result view -->
- <p>size is {{resultCount}}</p>
- <!-- main view which has ng-view -->
- <html ng-app="exApp">
- <body ng-controller="exApp.MainCtrl">
- <!-- form which submits to SearchCtrl -->
- <form name="searchform" ng-controller="exApp.SearchCtrl" ng-submit="search()">
- <input type="text" ng-model="queryString">
- </form>
- <div class="view-panel" ng-view></div>
- </body>
- </html>
- exApp.MainCtrl = function ($scope) {
- $scope.queryString = '';
- $scope.resultCount = 0;
- }
- exApp.SearchCtrl = function ($scope, $http) {
- function display(response) {
- $scope.poreqs = response["resource"];
- // should update the html, but does not
- $scope.resultCount = $scope.poreqs.length;
- }
- $scope.search = function () {
- $http.get('/search?q=' + $scope.queryString).success(display);
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement