Page 1 of 1

I get the following error when trying to refresh a google map: TypeError: null is not an object (evaluating 't[gF]')

Posted: Wed Feb 18, 2015 2:56 am
by Lin

My app uses the google map component to display current location. The geolocation service is invoked when the page loads and the map displays the current location marker correctly. When the refresh button is selected, the geolocation service is invoked again. This time, however, the marker appears for a fraction of a second then disappears. The error console displays the following message:

[Error] TypeError: null is not an object (evaluating 't[gF]')
jca (undefined, line 34)
(anonymous function)
instrumentedCode (target-script-min.js, line 3439)

Does anyone know what could be causing this error?


I get the following error when trying to refresh a google map: TypeError: null is not an object (evaluating 't[gF]')

Posted: Wed Feb 18, 2015 11:19 am
by Evgene Karachevtsev

Hello Lin,

Could you please share screenshots with detail information - what events are fired at your components(page and refresh button), parameters of your service, mapping?


I get the following error when trying to refresh a google map: TypeError: null is not an object (evaluating 't[gF]')

Posted: Thu Feb 19, 2015 3:07 am
by Lin

Hi Evgene,

Thanks for the quick reply. Attached are screenshots from my app. Let me know if this is the information you need.

Image
Image Image Image


I get the following error when trying to refresh a google map: TypeError: null is not an object (evaluating 't[gF]')

Posted: Thu Feb 19, 2015 5:40 am
by M&M

It could be that the map is in the process of loading, and the refresh method is being called. Just to narrow in, you can add a small interval using setTimeout, to check if that helps. If yes then you know exactly what to do :)


I get the following error when trying to refresh a google map: TypeError: null is not an object (evaluating 't[gF]')

Posted: Fri Feb 20, 2015 2:03 am
by Lin

Thanks for the suggestion M&M. I'm new to programming. I gather that you are recommending I use the settimeout function. I found an example (below), but I'm not quite sure how to use it.

setTimeout(function() {
// Do something after 5 seconds
}, 5000);

Could you be more specific?


I get the following error when trying to refresh a google map: TypeError: null is not an object (evaluating 't[gF]')

Posted: Fri Feb 20, 2015 3:24 am
by M&M

yup. What you can do is to refresh the map / clear the address after a slight delay - say 100 - 500 ms.

In short your 3 lines that do the refreshing - use them in the place of "// Do something after 5 seconds"

But ya 5 seconds is too long, perhaps a 100ms to 500ms value will be appropriate.


I get the following error when trying to refresh a google map: TypeError: null is not an object (evaluating 't[gF]')

Posted: Sat Feb 21, 2015 1:12 pm
by Lin

It Worked! Thanks M&M.