JSFiddle - React, Tailwind, and code Playground

by Pablo Leone

HTML

<script src="https://rawgit.com/grevory/angular-local-storage/master/dist/angular-local-storage.min.js"></script>
<div ng-app="myApp">
    <div ng-controller="testAngularLocalStorage">
        {{property}}
    </div>
</div>

JavaScript

var myApp = angular.module('myApp', ['LocalStorageModule']);

myApp.controller('testAngularLocalStorage', 
    function ($scope, localStorageService) {
        
        localStorageService.set('property', 'oldValue');
        
        var unbind = localStorageService.bind($scope, 'property');
        
        // Test Changes
        $scope.property = 'newValue1';
        console.log(localStorageService.get('property')) // newValue1;
        
        // unbind watcher
        unbind();
        
        $scope.property = 'newValue2';
        console.log(localStorageService.get('property')) // newValue1;   
    }
);