Skip to Content
Former Member
Jun 27, 2016 at 09:09 AM

Extensibility of UI5


Hi everybody,

I'm wondering how to implement shared code between some of my controllers and custom controls. From other frameworks I know the concept of services, which you can inject in other places to reuse their functions. Right now I'm trying to think of a good way to structure my code. So far I used kind of a controller-hierarchy, which works nicely. The most common functions go to the BaseController, functions common to for example a ShoppingBasket go to the BasketController and even more special functions go to the InvoiceController and they extend like this: BaseController->BasketController->InvoiceController.

But I also have functions, which I want to share between completley different parts of the application, but I hesitate to stuff all of them in my BaseController. Is there some kind of service-concept in UI5 that I am missing? How do you handle your code structure? Or do you just make some plain JS-Files, which you load by sap.ui.define?

Any feedback is welcome!

Best Regards,