From 12c8104c5b2afa1e18b5d0ae11332b3fec27fff4 Mon Sep 17 00:00:00 2001 From: Darryl Hebbes Date: Thu, 5 Jun 2014 18:34:15 +0200 Subject: [PATCH] Update README.md Added an example of binding to a $scope variable --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 8c298fb..7d474e6 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,20 @@ angular.module('yourModule', ['LocalStorageModule']) localStorageServiceProvider.setPrefix('newPrefix'); }]); ``` + +#### How to bind to a $scope variable: +Usage: localStorageService.bind(scope, key, def); +``` +// Example +$scope.anArtist = {'firstname':'Pablo', 'lastname':'Picasso'}; + +// Bind to local storage service +localStorageService.bind($scope, 'anArtist', anArtist); + +// get bound data: +console.log(localStorageService.get('anArtist')); +``` + Check out the full demo and documentation at http://gregpike.net/demos/angular-local-storage/demo.html To do: