Skip to content

Instantly share code, notes, and snippets.

@tofumatt
Created March 22, 2015 16:43
Show Gist options
  • Save tofumatt/ba24f105b8dcd96e1064 to your computer and use it in GitHub Desktop.
Save tofumatt/ba24f105b8dcd96e1064 to your computer and use it in GitHub Desktop.
i have key/value pairs stored via localforage by the main page, but i cant figure out how to bring up a list of keys for the about page. ng-repeat and ng-option dont seem to work, and i suspect it's because i'm not unwrapping my promises correctly? i dunno.
angular.module('scratchpadApp')
.controller('AboutCtrl', function ($scope, $localForage) {
var getKeys = function() {
localforage.keys()
.then(function(result) {
console.log(result);
$scope.getKeys = result;
});
};
});
and the html
<ul>
<li>stuff</li>
<li ng-repeat="key in getKeys()">{{key}}</li>
</ul>
<select ng-model="foo" ng-options="key for key in getKeys()"</select>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment