使用加载子状态,我在我的路由之间选择了eager transitions。这会导致URL在单击指向具有缓慢解析承诺的路由的链接时立即更新。然而,直到模型钩子的承诺得到解决并且转换完成之后,{{#link-to}}
帮助器才会得到它的active
类。
有没有办法在{{#link-to}}
改变并显示加载路径时自动激活URL?下面是一个示例JSBin:http://output.jsbin.com/pokujo#/about
发布于 2015-05-25 08:34:43
因为你没有提到ember-data ...你可以这样做(在ember-cli-simple-store的帮助下)
您的模型钩子将不会等待承诺来解析:)
model: function() {
var store = this.get("store");
var all = store.find("todo");
PromiseMixin.xhr("/api/todos").then(function(response) {
response.forEach(function(data) {
store.push("todo", data);
});
});
return all;
}
https://stackoverflow.com/questions/30399917
复制相似问题