Skip to content

Commit

Permalink
stores your inputted HTML in localstorage now
Browse files Browse the repository at this point in the history
  • Loading branch information
nicangeli committed Mar 9, 2014
1 parent cf10194 commit 1fb66bb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions slide_controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ app.directive('slideImage', function() {
});

app.controller('SlideController', function($scope, $sce, localStorageService) {
$scope.data = {htmlString:"", trustedVersion:""}
$scope.slideImages = [
'slides/1/cfg.001.jpg',
'slides/1/cfg.002.jpg',
Expand Down Expand Up @@ -236,14 +235,16 @@ app.controller('SlideController', function($scope, $sce, localStorageService) {
'slides/1/cfg.220.jpg',
'slides/1/cfg.221.jpg'
];
var html = localStorageService.get('html') || "";
$scope.data = {htmlString:html, trustedVersion:html}

var slideNos = localStorageService.get('currentSlideNum') || 0;
$scope.currentSlideNum = slideNos;
$scope.$watch('currentSlideNum', function(value){
localStorageService.add('currentSlideNum', value);
//$scope.currentSlideNum = localStorageService.get('localStorageDemo');
});
//localStorageService.add('currentSlide', $scope.currentSlideNum);




$scope.nextSlide = function() {
Expand Down Expand Up @@ -273,5 +274,7 @@ app.controller('SlideController', function($scope, $sce, localStorageService) {
$scope.$watch("data.htmlString", function(newValue) {
//debugger;
$scope.data.trustedVersion = $sce.trustAsHtml(newValue);
localStorageService.add('html', newValue);

}, true);
});

0 comments on commit 1fb66bb

Please sign in to comment.