I am trying to implement the Bootstrap UI Angular Carousel with WordPress WP-API. I am curious how to connect 'slides' with 'posts'
The demo HTML is...
<div class="carousel" ng-controller="CarouselDemoCtrl">
<div style="height: 305px">
<carousel interval="myInterval">
<slide ng-repeat="slide in slides" active="slide.active">
<img ng-src="{{slide.image}}" style="margin:auto;">
<div class="carousel-caption">
<h4>Slide {{$index}}</h4>
<p>{{slide.text}}</p>
</div>
</slide>
</carousel>
</div>
</div>
The javascript works fine separately. For example, I can use ng-repeat to display posts. The sample ng-repeat="slide in slides" displays the demo slides.
angular.module('app', ['ngRoute', 'ui.bootstrap' ])
// Retrieves Posts
.controller('Main', function($scope, $http, $routeParams){
$http.get('wp-json/posts/').success(function(res){
$scope.posts = res;
});
$http.get('wp-json/media/').success(function(res){
$scope.media = res;
});
})
The example Bootstrap implementation is...
//Bootstrap Carousel
.controller('CarouselDemoCtrl', function ($scope) {
$scope.myInterval = 5000;
var slides = $scope.slides = [];
$scope.addSlide = function() {
var newWidth = 600 + slides.length + 1;
slides.push({
image: 'http://placekitten.com/' + newWidth + '/300',
text: ['More','Extra','Lots of','Surplus'][slides.length % 4] + ' ' +
['Cats', 'Kittys', 'Felines', 'Cutes'][slides.length % 4]
});
};
});
How would I implement something that connects the slides and the posts? That way, it grabs, for example, the featured image from a post and inserts it into a slide?