[Persistence] Fix read in example

Values are stored in the scratchpad as JSON, so parse them
as JSON before returning them.
This commit is contained in:
Victor Woeltjen
2015-11-05 17:58:29 -08:00
parent d69cf6c6fe
commit eef801f1ae

View File

@@ -58,8 +58,10 @@ define(
};
ScratchPersistenceProvider.prototype.readObject = function (space, key) {
return this.$q
.when(space === 'scratch' ? this.table[key] : undefined);
return this.$q.when(
(space === 'scratch' && this.table[key]) ?
JSON.parse(this.table[key]) : undefined
);
};
ScratchPersistenceProvider.prototype.deleteObject = function (space, key, value) {