Skip to Content
Feb 19, 2016 at 07:11 AM

Two models in component.js


Hi team,

I have declared two different model in component.js.

One is oDatamodel. I didn't name it.

And another one is a JSON model. its a named model.

The problem is, I am able to bind the unnamed model in all views.

But When I tried to get JSON model, I am getting model is undefined.

The model visibility is not there in other views except in the root view.

For example if I use,

var model = this.getView().getModel("sampleModel"); //named JSON model

in root view, I am getting the object.

But If I use the same in other controller, I am getting undefined error.

Is there any way that I could fix this?


Karthik R