Access 'this.?' is 'undefined'

help me please!!!
access ‘this.??’ is always ‘undefined’, I can’t assign ‘this’ any value in ionic 3.20.0 for android

This is an exceptionally vague problem. What is this.??
If that’s a variable, it’s pretty poorly named. Question Mark’s are not ideal variable names,

Perhaps you could post the actual code that you’re referencing?

@sltruman plz share some piece of code.

@jaydz @ajaysaini
oh, I just access member function via ‘this’ but it is undefined.
it worked fine before,not only map of object even any variable.

where is your call to “atToSelf” function?

@sltruman, when you are calling atToSelf() function . this function is called before initialising variable

where do you see the calling for atToSelf() ?

@avishai_peretz_dev @ajaysaini
I called function atToSelf() in a button of page of html. that button called successed after called ionViewDidLoad().
the issue is that map is undefined but i have assign in ionViewDidLoad()

need to see code!
Please advise

which plugin you are using ?
and where you initialised coords ?
plz share link
try this one

@ajaysaini @avishai_peretz_dev
yeah, i am going to home.
i will share the code.
i consider it unrelated with type of map becase it is not only map even any variable.

@ajaysaini @avishai_peretz_dev
I solved it becase ionic not support directly binding ‘’ via jquery.
like following:
$(’.atToSelf’)[0].onclick = () => { this.atToSelf() } // ok is object
$(’.atToSelf’)[0].onclick = this.atToSelf // error is undefiend


You can use it with bind also

$(’.atToSelf’)[0].onclick = this.atToSelf.bind(this);

But what is the reason to use jQuery in ionic 3 project?

1 Like

jQuery is my favorite and ionic3 lacks some feature of operation of DOM so I use just jQuery.