What is the reason we sometimes use model.foo and other times just write.foo in our templates? Is it possible to make it more consistent so that I can always write .foo instead of model.foo?
For example i have two templates. One for adding a new client and one for editing a existing client.
Edit template
<form>
<section class="form-section">
<div class="left">
</div>
</section>
<button class="button" > Update client </button>
</form>
And the add new template
<form>
<section class="form-section">
<div class="left">
</div>
</section>
<button class="button"> Add client </button>
</form>
Corresponding routes
Edit route
import Ember from 'ember';
export default Ember.Route.extend({
model(params) {
return this.store.findRecord('client', params.client_id);
},
});
New route
import Ember from 'ember';
export default Ember.Route.extend({
});
Aucun commentaire:
Enregistrer un commentaire