@saidk wrote:
favorite
I'm creating an app for my wordpress blog using Ionic framework, it gets the latest post thumbnail (as my posts are basically a picture per post), I want to fetch previous post or next post using buttons or by swiping left or right, how can I do it, I've searched a lot but I only found infinite scroll method.Screenshot: http://i.stack.imgur.com/3BsMe.jpg
Here's my code: (controller.js)
angular.module('starter.controllers', []) .controller('LatestCtrl', ['$scope', '$http', function($scope, $http){ $scope.recent_posts = []; $http.get("http://haltaalam.info/api/get_posts/").then(function(data){ $scope.recent_posts = data.data.posts; $scope.id = $scope.recent_posts[0].id; $scope.recent_post_img = $scope.recent_posts[0].thumbnail_images.full.url; }, function(err){ }) }])
(view)
<ion-view ng-controller="LatestCtrl" cache-view="false"> <ion-list class="list list-inset" on-swipe-left="" on-swipe-right="" can-swipe="true"> <ion-item class="item item-image"> <img ng-src="{{recent_post_img}}"> </ion-item> <ion-item class="row item"> <div class="col"> <a class="button button-clear button-icon icon ion-ios-arrow-right button-ht" href="#"></a> </div> <div class="col "><button class="button button-clear button-ht icon ion-android-share-alt icon-left" ng-click="share();"></button></div> <div class="col "><button class="button button-clear button-icon icon ltr ion-ios-heart-outline button-ht" ng-click=""></button></div> <div class="col"> <a class="button button-clear button-icon icon ion-ios-arrow-left button-ht" href="#"></a> </div> </ion-item> </ion-list>
Posts: 1
Participants: 1