angular.module('eventTracker', [])
.controller('MainCtrl', ['$scope', 'Event', function($scope, Event){
$scope.eventData = {}
$scope.onSubmit = function(){
Event.Add($scope.eventData)
$scope.eventData = {}
}
}])
.factory('Event', function(){
if (!eventList) {
var eventList = []
}
return {
Add: function(event){
eventList.push(event)
},
List: eventList
}
})
Hey everyone, I'm facing a challenge with persisting eventList data after a page refresh. I'd appreciate any insights on why this might be happening! I prefer not to use cookies, local storage, or rootscope and thought my service was correctly set up. Any suggestions would be greatly valued! Everything works perfectly except that upon refreshing the page, all previous data is lost.