Hi All,
I am using $resource for extracting data from restful web service. I am using that data into ionic slider-box. I am facing problem to run ionic slider-box with response data. Below is the code:
Service.js:
abcServices.factory('abcService', [ '$resource', function($resource) {
return $resource(baseURL + 'xyz/:propId', {
propId : '@propId'
}, {
get : {
method : 'GET'
}
});
}]);
Controller.js:
.controller('abcCtrl', function($scope, $stateParams, abcService) {
$scope.property = {};
$scope.media = {};
$scope.media = abcService.get({},{propId:$stateParams.propertyId},function(response){
$scope.property = response;
$scope.media = response.mediaSet;
});
});
Json data(json array inside json object):
{
"id": 5,
"addr1": "F-24",
"mediaSet": [
{
"id": 1,
"label": "Test 1"
},
{
"id": 2,
"label": "Test 2"
}
]
}
html:
<ion-slide-box ng-controller="abcCtrl" on-slide-changed="slideHasChanged($index)" does-continue="true" show-pager="false">
<ion-slide ng-repeat="prop in media">
<h3>{{ prop.label }}</h3>
<p>{{ prop.id }}</p>
</ion-slide>
</ion-slide-box>
If I run slider box with static array data slider box do run. With dynamic data I am facing some issue.
My findings: Width is 0px because length is 0(in js file). Please do let me know if someone of you found any solution for this.