Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70429

How to get contains of specific id from json by clicking on the list

$
0
0

@mathanxp2000 wrote:

controller.js

           .controller('FeedCtrl', function($scope, $http) {
            var path = 'data/data.json';
           var conditions = $http.get(path).then(function(resp) {
           // $http.get('https://api.myjson.com/bins/147ny').then(function(resp) {
          $scope.conditions = resp.data.employees ;  

                }, function(err) {
            console.error('ERR', err);
              // err.status will contain the status code
             })

           .controller('FeedDetailCtrl', function($scope, $stateParams ) {
              $scope.condition = conditions.get($stateParams.feedId);
         })
          });

app.js

           .state('tab.feed', {
          url: '/feed',
          views: {
            'tab-feed': {
               templateUrl: 'templates/tab-feed.html',
             controller: 'FeedCtrl'
             }
           }
         })

     .state('tab.feed-detail', {
     url: '/feed/:feedId',
       views: {
     'tab-feed': {
     templateUrl: 'templates/feed-detail.html',
    controller: 'FeedDetailCtrl'
    }
    }
   })
   ;

tab-feed.html

 <ion-view view-title="Chats">
  <ion-content >
 <ion-list>
 <ion-ng-repeat="condition in conditions"  type="item-text-wrap"  href="#/tab/feed/{{condition.id}}">

<h2>{{condition.firstName}}</h2>
<p>{{condition.lastName}}</p>
<i class="icon ion-chevron-right icon-accessory"></i>


</ion-item>
</ion-list>
 </ion-content>
 </ion-view>

feed-detail.html

 <ion-view view-title="{{condition.firstName}}">
 <ion-content class="padding">


 <p class="font-color">


 {{condition.lastName}}

 </p>
 </ion-content>
 </ion-view>

What i want is once i click on any of the option from the list and the next page should display the data available in the json file which belongs to the specific id.Thank you.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70429

Trending Articles