|
6 | 6 | <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"> |
7 | 7 | <link href="./example.css" rel="stylesheet"> |
8 | 8 | <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js"></script> |
9 | | - <script src="https://github.com/js-data/js-data/releases/download/1.2.0/js-data.min.js"></script> |
10 | | - <script src="https://github.com/js-data/js-data-angular/releases/download/2.1.0/js-data-angular.min.js"></script> |
11 | | - <script |
12 | | - src="https://github.com/js-data/js-data-localstorage/releases/download/1.0.0/js-data-localstorage.min.js"></script> |
| 9 | + <script src="https://cdnjs.cloudflare.com/ajax/libs/js-data/2.8.2/js-data.min.js"></script> |
| 10 | + <script src="https://cdnjs.cloudflare.com/ajax/libs/js-data-angular/3.1.0/js-data-angular.min.js"></script> |
| 11 | + <script src="https://cdnjs.cloudflare.com/ajax/libs/js-data-localstorage/2.1.3/js-data-localstorage.min.js"></script> |
13 | 12 | <script src="./example.js"></script> |
14 | 13 | </head> |
15 | 14 | <body data-ng-controller="localStorageCtrl as lsCtrl"> |
@@ -56,22 +55,16 @@ <h3 class="panel-title">Users</h3> |
56 | 55 | <div> |
57 | 56 | <pre><code> |
58 | 57 | angular.module('localStorage-example', ['js-data']) |
59 | | - .factory('store', function () { |
60 | | - var store = new JSData.DS(); |
61 | | - |
62 | | - store.registerAdapter('localstorage', new DSLocalStorageAdapter(), { default: true }); |
63 | | - |
64 | | - return store; |
| 58 | + .run(function (DS, DSLocalStorageAdapter) { |
| 59 | + DS.registerAdapter('ls', DSLocalStorageAdapter, { default: true }); |
65 | 60 | }) |
66 | | - .factory('User', function (store) { |
67 | | - return store.defineResource('user'); |
| 61 | + .factory('User', function (DS) { |
| 62 | + return DS.defineResource('user'); |
68 | 63 | }) |
69 | 64 | .controller('localStorageCtrl', function ($scope, $timeout, User) { |
70 | 65 | var lsCtrl = this; |
71 | 66 |
|
72 | | - User.findAll().then(function (users) { |
73 | | - $scope.users = users; |
74 | | - }); |
| 67 | + User.findAll(); |
75 | 68 |
|
76 | 69 | User.bindAll({}, $scope, 'users'); |
77 | 70 |
|
|
0 commit comments