Ember 2.3 Routes as Controllers

Hi All,

This is the case when we are shifting from Ember 1.x to 2.3. As mentioned Controller will be deprecated soon. Routes will now be acting as controllers too. Controllers had properties and methods. In routes actions hook is place used for methods. Please tell where to declared properties in routes and how do we access/ call them.

Regards

#Dn #ember-cli

can you give very simple example of what you try to port? AFAIK routes’ properties are accessible in templates and can there be passed to components

In my route.js

export default Ember.Route.extend({
a: '',
b: '',

actions: {
  getA(){
    var getA = this.get('a');

           //Here it is not able to access a, in templates binding is working fine with input helpers, but when I try to read the values I get an error of undefined.
  },
}
});

Hi Deepak, I would not use the route to hold state. If you don’t want to use controllers you may find the “shim layer” technique used here helpful.

Actually you can’t access route properties from a template.