<div ng-app='myApp' class='reveal' ng-controller='MyController'> <a ng-click="addSlide()"></a> <div slideshow='slides'></div> </div> <script type='text/javascript' src='https://raw.github.com/hakimel/reveal.js/master/js/reveal.js'></script>
var app = angular.module('myApp', []); app.directive('slideshow', function() { return { scope: { slides: '=slideshow' }, link: function(scope, elem, attrs) { elem.addClass('slides'); for (var i = 0; i < scope.slides.length; i++) { var section = angular.element("<section>"); var steps = scope.slides[i].steps; if (steps.length == 1) { var content = angular.element("<h1>").html(steps[0]); section.append(content); } else { for (var j = 0; j < steps.length; j++) { var subSection = angular.element("<section>"); if (j < steps.length - 1) subSection.attr('data-autoslide', '1000'); var content = angular.element("<h1>").html(steps[j]); subSection.append(content); section.append(subSection); } } elem.append(section); } Reveal.initialize({ loop: false, transition: Reveal.getQueryHash().transition || 'none' }); } }; }); app.controller("MyController", function($scope) { $scope.slides = [ { 'steps': ['a'] }, { 'steps': ['b1', 'b2'] }, { 'steps': ['c1'] } ]; $scope.addSlide = function() { alert("working"); for (var j = 0; j < steps.length; j++) { var newSlide = $scope.slides.length+1; // $scope.slides.push({'slide',+ steps}); console.log(newSlide); });
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)