Skip to Content
author's profile photo Former Member
Former Member

app is undefined

Hi

I'm trying to make my hybrid web container app move to the next view/page when a button is clicked. I have had a look at some sample code as follows -

This is inside the sample controller.js file -

productListTap : function(evt) {

var data = {};

data.context = evt.getSource().getBindingContext();

var app = this.getView().app;

app.to("ProductDetail", data);

},

This is my controller code -

moveToNextViewTap : function(evt)

{

var app = this.getView().app;

app.to("EndView");

},

I have debugged this in chrome and find that my 'app' variable is undefined and therefore does not do anything. I cant figure out why though.

What is missing?

Regards

Riaz

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 30, 2013 at 04:48 PM

    Hi Riaz,

    It's pretty hard to help you with so few lines of code. It seems like your variable "app" has never been initialized, so I guess you should do it somewhere, mainly in the init method of your controller. In this case, you ensure your variable has been set when moveToNextViewTap handler is called.

    Anyway, if you look at the rest of your sample code, this variable must have been initialized somewhere.

    If you need more help, please post more of your code, so we can help you more efficiently 😉

    Regards,

    Jerome

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.