cancel
Showing results for 
Search instead for 
Did you mean: 

app is undefined

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Jerome

It was as you stated, the app variable was never being defined in the app controller initially. Thanks for the help!

Regards

Riaz

Answers (0)