Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
HTML
<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>


Javascript

JavaScript
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);
	 
});
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900