1

I'm using willTransition hook inside my router as follows.

actions: {
        willTransition(transition) {
            this._super(...arguments);
            //some code goes here
        }
    }

Is there a way to access some property here that is set from controller.

For example: inside my controller, i set value 500 to someProperty as follows.

this.set('someProperty', 500);

How can I access that value inside above method(within the router). Appreciate any help.

Channa
  • 3,267
  • 7
  • 41
  • 67
  • You mean you want to access the `controller` in the `route` and not in the `router`. There's a clear distinction between the two. – Sabin Sep 02 '17 at 04:09

1 Answers1

0

You can try controller property,

this.controller.set('someProperty',500)
Ember Freak
  • 12,918
  • 4
  • 24
  • 54
  • Actually I want to get that value inside router. When I'm using `this.controller.get('someProperty')` it gives `undefined` – Channa Jan 09 '17 at 09:52
  • just do `console.log(' Controller properties ', this.controller);` and inspect what is going wrong ? is it the property name is not yet defined...You have one more option `this.controllerFor('routename')` will give controller instance – Ember Freak Jan 09 '17 at 10:02