New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with asyn routing #1268
Comments
PR #1183, which was merged a few weeks ago, offers a solution to your problem. To take advantage of it, you will need to make the result of your deserialize method implement the promises pattern. |
Sorry for that issue, i look, but don't fine any things. Thanks |
I need help too, please. May be you create a fiddle? |
I finally get it:
While 'page' is loading the router goes to state 'loading'. I defined that state in the router:
I created a view for loading whith an ajax loader gif. All work ok. Good Job Wagenet. |
can you post a fiddle example??, i can't make works. Thanks |
@leroj7 that worked perfectly for me, thanks for sharing that code |
@trek: I would say that @leroj7's solution is one possible approach. The requirement is the deserialize return something that as a |
Here is a fiddle http://jsfiddle.net/krisselden/uErrd/ if you want to see the urls you can go directly to http://jsfiddle.net/krisselden/uErrd/show/ When routes are nested, you need a loading state at each level. |
I have a loading state at each level. Sometimes, the router makes to the later states; sometimes, it hangs at |
UPDATE The loading object may already be loaded when serialize is called so do, deserialize: (router, params) ->
report = @_super(router, params)
deferred = $.Deferred()
if report.get('isLoaded')
deferred.resolve(report)
else
report.one 'didLoad', ->
deferred.resolve(report)
deferred.promise() |
Does not adding an observer cause a leak? Will the observer be automatically torn down?
|
Is there a solution for this with the new router? I have read #1378, #1183, ghempton's gist, lukemelia's gist, and this SO question, but they all refer to the old router. |
Solved. Posting solution here just in case anybody comes across this: App.FoosIndexController = Em.ArrayController.extend
someAction: ->
foo = App.Foo.find(1) # id might as well come from somewhere
if foo.isLoaded
@transitionToRoute 'foos.show', foo
else
foo.one 'didLoad', => @transitionToRoute 'foos.show', foo |
Hi,
I have this code (http://jsfiddle.net/cristobal151/GCSdd/1/):
It work when i load the list of post and then go to one post, but when a want to enter with the url of a post, the serialize and derialize dont wait to load the post from an api y send me an error.
How can i asyn a rout when enter for the first time in the url??
Thanks
The text was updated successfully, but these errors were encountered: