Is there a "right" way to make the setupController hook fire consistently?
First, I'm sorry, but I can't show any actual code at the moment.
I have a page with a search bar. Upon entering text and clicking enter, a
transition occurs to the same page with a query in the URL. Due to the way
the model and setupController hooks fire, I have set up my code as
follows:
model: Updates the search text field with the text that was passed, and
changes the controller's model to the current JavaScript timestamp as a
hack to force the call to setupController.
setupController: obtains the text from the search field, and should then
update the model with the proper search results (NYI)
What I'm doing in the model hook seems downright hacky, but I'm not quite
sure how else to go about this in a way that remains consistent with both
somebody manually adjusting the URL and a proper transitionTo.
I'd appreciate it if somebody could tell me if there's a "right" way to
ensure that setupController is called regardless of whether or not Ember
thinks that the model has changed (which seems to be the culprit that's
currently necessitating the hack.)
No comments:
Post a Comment