是否可以手动重新进入加载状态?
现在我有一个模板符合他们网页上提到的加载规则:
如果,Ember将在上述位置找到装载路线
[...]
已经找到了一个名称正确的加载模板,例如
酒吧/加载 富/加载 装载
转换到页面时,它使用此模板,这很棒。 但是,我想在我的网络请求忙时进入相同的加载状态。 目前,我正在重新实现页面中的模板并切换它,这会复制代码。 当我处于加载状态或不手动时,我宁愿告诉ember。
编辑:响应评论,网络请求设置和推送数据到模型(搜索按钮和“无限滚动”分页)
Is it possible to reenter the loading state manually?
Right now I have a template that matches the loading rule mentioned at their webpage:
Ember will find a loading route at the above location if
[...]
a properly-named loading template has been found, e.g.
bar/loading foo/loading loading
When transitioning to the page, it uses this template, which is great. However, I would like to enter that same loading state while my web request busy. Currently, I am reimplementing that template in the page and toggling it, which duplicates code. I would rather tell ember when I am in loading state or not manually.
Edit: In response to comment, the web requests both set and push data to the model (search button and "infinite scroll" pagination)
最满意答案
您可以在请求正在进行时使用transitionToRoute()过渡到(和退出)加载路径。
You could use transitionToRoute() to transition into (and out of) a loading route while your request is in progress.
更多推荐
发布评论