Skip to Content
avatar image
Former Member

new UI5 MVC Controller

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Dec 22, 2016 at 08:15 PM

    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

    Add comment
    10|10000 characters needed characters exceeded