I am currently working on building a Hybrid mobile app using Angular and Ionic frameworks. Below is the sample data that I have obtained:
$scope.data = [{
"PID": 108,
"Name": "Demo",
"TID": 20,
"date": "2016/00/29"
}, {
"PID": 98,
"Name": "Sports Demo1",
"TID": 20,
"date": "2016/06/02"
}, {
"PID": 98,
"Name": "Sports Demo2",
"TID": 20,
"date": "2016/06/02"
}, {
"PID": 98,
"Name": "Sports Demo3",
"TID": 20,
"date": "2016/06/02"
}, {
"PID": 98,
"Name": "Sports Demo4",
"TID": 20,
"date": "2016/06/02"
}]
Code for the first page HTML :
<ion-content class="" padding="true">
<ul ng-repeat="dataSch in data">
<li class="item" style="border-width: 0px;">
<div class="item" style="border-width: 0px; padding : 1px;">{{dataSch.Name}}</div>
<div class="item" style="border-width: 0px; padding : 1px;">{{dataSch.date}}</div>
</li>
</ul>
</ion-content>
Code for the second page HTML :
<ion-content class="" padding="true">
<div>Detail 1</div>
<div>Detail 2</div>
</ion-content>
<ion-footer-bar align-title="left" class="bar-assertive">
<button ng-click="next()">Next</button>
<button ng-click="previous()">Previous</button>
</ion-footer-bar>
In the first page, by clicking on an "li" element based on "PID", I can navigate to the second page with all the details. However, on the second page, there are options in the footer to move to next or previous data from there itself. But how can I display the next or previous data on the second page?
For example, if I clicked on the second element on the first page and got the data Name as "Sports Demo1" on the second page, clicking on Next button should show "Sports Demo2" and clicking on Previous should show "Demo".