问题
I have a condition where my route:
application.com/#/sample/:id
is redirected back to application.com/#/sample/:id
For example,
application.com/#/sample/1
gets an event which redirects to application.com/#/sample/2
This does not cause a reload. Has any one got this case fixed?
Actually I am having a case
application.com/#/parent/123/sample/1
causing redirect to application.com/#/parent/123/sample/2
Event is received by ParentRouter
to transitionTo("parent.sample",{id:2})
.
What I get in the log is:
Uncaught Error: assertion failed: Emptying a view in the inBuffer state is not allowed and should not happen under normal circumstances. Most likely there is a bug in your application. This may be due to excessive property change notifications.
回答1:
For transit into route manually, you may try these two methods:
For routes with different name:
App.Router.router.transitionTo(name, params);
For routes with same name:
App.Router.router.getHandler(name).enter();
It should be identical to call
enter
event of route. (I'm not sure)
回答2:
The issue is fixed. Its was a NULL handling issue in the handlebars. I made some additional check for nulls. It works now.
There have been some similar issues filed on Github, we can always reload the current route and redirect back to any route.
Thanks for help.
来源:https://stackoverflow.com/questions/16008047/how-can-we-reload-a-route-ember-js-versoin-1-0-0-rc-1