Routing emberjs动态路由,序列化给定未捕获的TypeError:无法调用方法';获取';未定义的
为什么在Routing emberjs动态路由,序列化给定未捕获的TypeError:无法调用方法';获取';未定义的,routing,ember.js,Routing,Ember.js,为什么在序列化函数行id=context.get('id')中抛出错误 具体来说,为什么在我加载索引路由时它甚至试图运行序列化 完整演示: 错误在{{action goToShowPost context=“post”href=“false”}中。 我相信它是向后兼容的,但似乎不是。 现在您必须直接传递上下文,如下所示: {{action goToShowPost href=“false”} serialize: function(router, context) {
序列化函数行id=context.get('id')中抛出错误代码>
具体来说,为什么在我加载索引路由时它甚至试图运行序列化
完整演示:
错误在{{action goToShowPost context=“post”href=“false”}
中。
我相信它是向后兼容的,但似乎不是。
现在您必须直接传递上下文,如下所示:
{{action goToShowPost href=“false”}
serialize: function(router, context) {
var rtnVal = {},
id = context.get('id');
if (context) {
rtnVal = {post_id: id};
}
return rtnVal;
}