2016-07-30 66 views
2

我如何归档不同的http请求主详细信息概念?归档主详细概念与不同的http请求离子

我有一个有一个或多个孩子的类别列表。然后我有一个细节视图,应该只显示与父元素相关的表格中的内容。

什么,我现在是这样的:

.controller('CatsCtrl', function($scope $http) { 
      $scope.goToDetail = function(id) { 
       $state.go("detail") 
       $scope.update(id); 

      } 

      $http.get(Backand.getApiUrl() + '/1/objects/Card') 
      .then(function(response) { 
       $scope.content = response.data.data; 
      }); 

}) 

    .controller('DetailCtrl', function($scope $http) { 
     $http.get(Backand.getApiUrl() + '/1/objects/Card') 
     .then(function(response) { 
      $scope.content = response.data.data; 
     }); 
     }) 

HTML

<div ng-repeat="cat in content" class="animated lightSpeedIn"> 
     <a href="#/details/{{cat.id}}" nav-transition="none"><div ng-style="{'background': 'url(' + cat.catBgUrl + ')','background-repeat': 'no-repeat','background-size': '100% 100%','display': 'block','width': '100%','height': '25vh' }" class="bgcat center"> 
     <div class="inner"> 
      <h1>{{cat.catName}}</h1> 
      <h4>{{cat.catSubtitle}}</h4> 
      <img src="img/home/open.png" alt=""> 
     </div> 
     </div></a> 
    </div> 

路线

.state('details', { 
     url: '/details/:id', 
     templateUrl: 'templates/detail.html', 
     controller: "DetailCtrl", 
     cache: false 
    }) 
.state('cats', { 
     url: '/cats', 
     templateUrl: 'templates/cats.html', 
     controller: "CatsCtrl", 
     cache: false 
    }) 

我在这头,因为12小时不作任何进展。我使用backand.com作为数据。你可以分享一个链接或帮我一点,我可以如何将这3个不同的http请求归档?

任何帮助非常感谢!

回答