lundi 3 juin 2019

In EmberJS how can you use transition data in a controller?

I am getting the transition data in the route js file like so:

beforeModel(transition) { console.log(transition)  }

And I want to use it in a function in my controller like this:

import Controller from '@ember/controller';

export default class ListingsController extends Controller {

    get pageTitle() {
        if (this.transition.targetName == 'foo') {
        return 'page title';

        }
      }

}

And then I want to display the result like this:

<h1></h1>

I cannot find a way to pass the transition data from the route to the controller. Any ideas?




Aucun commentaire:

Enregistrer un commentaire