I have 3 related questions;
Q1: In EmberJS, can "model" be treated as special controller property.
I am saying this, coz consider for a controller (has model returning firstName & lastName attributes), I have a property "isVisible"
So in the template, I would say
{{#if isVisible}}
Hello {{model.firstName}}, {{model.lastName}}
{{/if}}
Now here, "isVisible" is controller property and referred directly, whereas to display firstName/lastName, we say model.firstName & model.lastName
So that makes it seem like "model" is some kind of special property defined on the controller somewhat similar to "isVisible"
Q2: Also, I assume the model's value would always be returned by the corresponding route's model hook. Not sure if there are many other ways ?
Q3: Also is "model" a special/reserved keyword which Ember recognizes. I am asking this, coz I have observed
self.controllerFor('someroute').get('model.someParam')
It would be great if you could point the Ember library code for get/set where Ember handles this "model" keyword.
Aucun commentaire:
Enregistrer un commentaire