mercredi 18 octobre 2017

Ember.js: Model affected by setupController during model iniitalization

I have run into weird asynchronous behavior in an Ember app that I am working on. I have code in a setupController function that modifies an attribute on the model depending on certain existing properties of the model.

It seems, however, that this code is running before the model has been fully initialized, meaning it's checking against a not-yet-initialized model and making changes. I have discovered this behavior using console.logs in the model function in the route file.

I understand that Ember has a lot of asynchronous components, but how can the model's state in it's initialization be affected by hooks that come later in the transition process? Is this expected behavior in a promise-based system?




Aucun commentaire:

Enregistrer un commentaire