Ben Bacarisse
7/29/2015 9:50:00 AM
puritanpaul@gmail.com writes:
> Can someone offer a way around this problem?
>
> MyClass.prototype.selectClinic = function() {
> this.otherClass.doSomething( this.selectClinicSuccess );
> }
>
> MyClass.prototype.selectClinicSuccess = function() {
> this.getProperty()
> }
>
> MyClass.prototype.getProperty = function() {
> // do some stuff
> }
>
> When I land in selectClinicSuccess, I'm getting this.getProperty is
> not a function.
You don't show enough code to be sure, but passing
this.selectClinicSuccess to doSomething is almost certainly wrong.
doSomething probably call calls its argument, in which case 'this' will
be undefined inside selectClinicSuccess. You might want
this.otherClass.doSomething( this.selectClinicSuccess.bind(this) );
--
Ben.