I trying use both AngularJS and reveal.js together. The following works:
<!doctype html>
<html ng-app>
<head>
<link rel="stylesheet" href="lib/reveal/css/reveal.min.css">
<script type="text/javascript">
function MyController($scope, $http, $location) {
$scope.location = $location;
$http.get('slides.json').success(function(data) {
$scope.slides = data;
setTimeout(function() {
Reveal.initialize();
}, .1 * 1000);
});
}
</script>
</head>
<body>
<div class="reveal">
<div class="slides" ng-controller=MyController>
<section ng-repeat="slide in slides">
<section ng-repeat="image in slide.images">
<img ng-src="{{image}}" />
</section>
</section>
</div>
</div>
<script src="lib/angular/angular.js"></script>
<script src="lib/reveal/reveal.js"></script>
</body>
</html>
Setting a time out feels so wrong. How should I change this?
I've been battling with a similar problem, I seem to have just solved it. As you suspected, using a 'timeout' will cause problems if it takes longer than 1 second for the data to load (which it probably doesn't if testing locally, but likely will when in production).
Check this solution:
To make your solution more 'Angular' though, you may want to:
Hope that helps, good luck!
This may not be exactly related to the question but can be considered to achieve the desired output. I used angular-leap library for slides. It provides great animations too.
here is demo.