What is causing the this
keyword to return undefined in the event handler and how can this issue be resolved?
twittyApp.factory('Unshown', function () {
function Unshown() {
this.allIsLoaded = false;
this.loading = false;
this.firstTime = true;
this.scrollMarker = 100;
this.loadedUnshownPages = 0;
this.timeLineHiader = $cookies.get("lastReadedTweetId");
}
window.onscroll = function () {
//Why is 'this.scrollMarker' undefined here?
};
return Unshown;
});