angular.js は初めてです。ngStorageを使用して、アプリの特定のカウンターの sessionStorage をサポートしようとしています
次のメソッドは、コメントの特定のカウンターを返します。sessionStorage を使用して、このカウンターを保存および読み取りたいと考えています。
var commentCounter = function () {
var commentCounter = {
incrementCount:function () {
var currentCount = myCounter.readPageViewCount();
currentCount++;
myCounter.recordPageViewCount(currentCount);
},
recordPageViewCount:function (pageViewCount) {
var lastRecorded = new Date().toUTCString();
// Need to record the counter
},
readPageViewCount:function () {
var sessionCounter = 0;
// Read counter from session
return sessionCounter;
}
}
return commentCounter;
}
この sessionStorage を正しい方向に処理するのを手伝ってくれる人はいますか?