Skip to Content

share data between controllers

hello

i need to share data between controllers in the same app.

routing/navigation with parameters is not an option - there is no direct navigation between the controllers/views.

options being considered include having a 'global' model OR using an EventBus.

any thoughts/comments greatly appreciated.

any other options?

cheers

pas.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Oct 30, 2017 at 03:23 PM

    Hi Pas,

    first of all: Don't store the data in a global object! Never do that! :)

    Having a model on your Component does not all make it 'global'. It is still very well contained inside your application and does not disturb or pollute the launchpad or any other application.

    // 'sending' controller
    this.getOwnerComponent().setModel(oModel, "data");
    
    // 'reveiving' controller
    this.getModel("data")

    That is probably the solution to go for.

    BR

    Chris

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 30, 2017 at 11:17 AM

    you can put the model in component, which will be global, all the view can see it...

    Add comment
    10|10000 characters needed characters exceeded