搜索页与首页对接

contentController.js

app.controller("contentController",function ($scope,contentService) {

    $scope.contentList=[];

   $scope.findByCategoryId=function (categoryId) {
       contentService.findByCategoryId(categoryId).success(
           function (response) {
              $scope.contentList[categoryId]=response;
           }
       );
   }

   $scope.search=function () {
       location.href="http://localhost:9104/search.html?keywords="+$scope.keywords;
   }
});

index.html


									

searchController.js

$scope.search=function () {
        $scope.searchMap.pageNo=parseInt($scope.searchMap.pageNo);
        searchService.search($scope.searchMap).success(
            function (response) {
                $scope.resultMap=response;
                buildPageLabel();
            }
        );
    }

$scope.loadKeywords=function () {
       $scope.searchMap.keywords=$location.search()['keywords'];
       $scope.search();
   }

search.html


 

你可能感兴趣的:(搜索页与首页对接)