Skip to main content
added 475 characters in body
Source Link
sfdcfox
  • 501.7k
  • 21
  • 473
  • 828

You need a reference outside the inner function to this:

// in outer function
var self = this;

...

self.func2(component);

When a method is called, "this" is typically set to the object that called the function. Sometimes it's hard to tell what "this" even is. Most likely, "this" inside your particular function refers to the FullCalendar module, or perhaps jQuery, but most certainly doesn't refer to the helper object.

As an alternative, you can use arrow functions, but be aware that IE does not support them (but Edge does).

viewRender: (view) => { this.func2(component); }

You need a reference outside the inner function to this:

// in outer function
var self = this;

...

self.func2(component);

You need a reference outside the inner function to this:

// in outer function
var self = this;

...

self.func2(component);

When a method is called, "this" is typically set to the object that called the function. Sometimes it's hard to tell what "this" even is. Most likely, "this" inside your particular function refers to the FullCalendar module, or perhaps jQuery, but most certainly doesn't refer to the helper object.

As an alternative, you can use arrow functions, but be aware that IE does not support them (but Edge does).

viewRender: (view) => { this.func2(component); }
Source Link
sfdcfox
  • 501.7k
  • 21
  • 473
  • 828

You need a reference outside the inner function to this:

// in outer function
var self = this;

...

self.func2(component);