Skip to Content
0

new UI5 MVC Controller

Dec 22, 2016 at 08:29 AM

107

avatar image
Former Member

Hi Everybody,

I am trying to instantiate a new sap.ui.core.mvc.Controller but it is not quite working.To give a bit of background: I want this new controller to control all of my fragments.

So i tried to instantiate it with : var oControl = new sap.ui.core.mvc.Controller("Fragment");

But I am always getting this error: Controller type "Fragment" is still undefined after trying to load it.


Any suggestions on how to solve this issue?

Best regards

Christoph

mvc
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Sergio Guerrero Dec 22, 2016 at 08:15 PM
1

i think what you can do is... create your fragment.. when you instantiate it.. you can pass in the controller that it needs

in your viewController, you will have in the header you can pass in the controller you need as such:

sap.ui.define([ "sap/ui/core/mvc/Controller",

"path/to/your/controller"

], function (Controller, yourController) {

} );

then in your controller body.. you have some code like this to instantiate your fragment.

sap.ui.xmlfragment("fragmentName", yourController);

hope this works

Share
10 |10000 characters needed characters left characters exceeded