jeudi 31 décembre 2015

In Emberjs, how do you use in the template file, properties defined in the route?

Say i have a route file like:

import Ember from 'ember';

export default Ember.Route.extend({
    [...]
    password: "...",
    [...]
});

How do i use the password property in a template?
If i use {{password}} it does not work, however, if i define a controller with a password property, i can then use {{password}} in the template, but given the fact controllers shouldn't be used anymore, what are my options?

I know that i can do something like this in the route:

import Ember from 'ember';

export default Ember.Route.extend({
    model(){
       return {
            password: "...",
       }
    },
});

And then access {{model.password}} but i don't think this is the way to go here.




Aucun commentaire:

Enregistrer un commentaire