cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Uncaught TypeError: undefined is not a function

TimMuchena
Participant
0 Likes
873

Hello people

I am having an issue where I get the error as shown below. I am able to display the fist/master page. I get the error when I try to navigate to the detail page to view details of a selected item

Kind regards

Accepted Solutions (1)

Accepted Solutions (1)

scott_stefanich
Active Participant
0 Likes

Hello Mr. Eli,

'Undefined is not a function' is a broad error which can be caused by things such as calling a function on an undefined object, using 'this' out of context from within a function, and beyond.

This is a complete guess, but perhaps you are using this.getModel() instead of this.getView().getModel()

Like Santhosh suggested, please share the Master navigation code, as well as the Detail onInit code.

Regards,

Scott

TimMuchena
Participant
0 Likes

Its now working. I have a base Controller object for accessing the Router and was not referencing it correctly in my detail controller.

Thank you

Answers (2)

Answers (2)

Former Member
0 Likes

This is a common JavaScript error that happens when you try to call a function before it is defined. You get "'undefined' is not a function" error when you try to execute a function that is uninitialized or improperly initialized . It means that the expression did not return a function object. So you have to figure out what you are trying to execute isn't a function.

In Javascript , when you execute a function, it's evaluated like the following:

  • expression.that('returns').aFunctionObject(); // js execute ->
  • expression.that('returns').aFunctionObject // what the JS engine does

That expression may be complex. So when you get undefined is not a function it means that expression did not return a function object. So you have to figure out what you are trying to execute isn't a function.

santhu_gowdaz
Active Contributor
0 Likes

Hi Mr Eli,

               Please provide the navigate code.