Cannot read property 'removeEventListener' of null - Error explantation.
-
I was getting two errors:
-
"Cannot read property ‘removeEventListener’ of null "
-
and then “pushPage is already running” (broke navigation).
With some digging I found sort of an obscure post that mentioned “setTimeout”: https://community.onsen.io/topic/3303/uncaught-in-promise-pushpage-is-already-running/2
I gave it a go and inserted a setTimeout to my function and everything works now. See below:
function editItem(getName, getDetails) { document.querySelector('#myNavigator').pushPage('page4.html').then(setTimeout (function(){ var noteName = document.getElementById('note-name'); var noteDetails = document.getElementById('note-details'); noteName.innerHTML = getName; noteDetails.innerHTML = getDetails; }), 5000); }
Now it seems to work better. However, after a couple of clicks I get the errors again. Can anybody lead me in the right direction so I can research this better. Thanks.
-