Ember无法转换到路线

时间:2015-06-29 19:12:58

标签: javascript ember.js ember-data transitions

假设我在abc.com/a?id=1(过渡1 T1 ),我希望transitionToRoute再次完全过渡到abc.com/a?id=2(过渡2 T2 )。

T1:在a的路由器中正确解析了a的模型,var t1 = this.transitionToRoute('a',{queryParams:{id:1}})返回了一个健康对象。

转移转储下面的承诺对象是:"Router: Settle transition promise when transition is finalized"

Transition {state: TransitionState, intent: C, router: Router, data: Object, resolvedModels: Object…}
 _visibleQueryParams: Objectdata: 
ObjecthandlerInfos: Array[2]
intent: C
isActive: false
params: ObjectpivotHandler: Class
promise: Promise
queryParams: Objectresolve
Index: 1
resolvedModels: Object
router: Router
sequence: 2
state: TransitionState
targetName: "index"

确定。

现在我们处于T1的路径中,因此在控制器a中,我们发送一个操作以冒泡到index主应用程序控制器,以便重新过渡到a使用新的参数集(T2)。

T2:var t2 = this.transitionToRoute('a',{queryParam:{id:2}}未正确解析。所有参数都缺少对象,intent未定义,承诺显示为"Router: Transition complete"

Transition {state: TransitionState, intent: undefined, router: Router, data: Object, resolvedModels: Object…}
_visibleQueryParams: Object
data: Object
intent: undefined
params: Object__proto__: Object
promise: Promise_id: 847_label: "Router: Transition complete"_onerror: null_result: TransitionState_state: 1
_subscribers: Array[0]
__proto__: Promisequery
Params: Object
__proto__: Object
__defineGetter__: __defineGetter__() { [native code] }__defineSetter__: __defineSetter__() { [native code] }__lookupGetter__: __lookupGetter__() { [native code] }__lookupSetter__: __lookupSetter__() { [native code] }constructor: Object() { [native code] }hasOwnProperty: hasOwnProperty() { [native code] }isPrototypeOf: isPrototypeOf() { [native code] }propertyIsEnumerable: propertyIsEnumerable() { [native code] }toLocaleString: toLocaleString() { [native code] }toString: toString() { [native code] }valueOf: valueOf() { [native code] }get __proto__: __proto__() { [native code] }set __proto__: __proto__() { [native code] }queryParamsOnly: trueresolvedModels: Object__proto__: Objectrouter: Routerstate: TransitionState__proto__: Object

我完全不理解为什么第二次完全转换到同一路线会因参数更改而失败。我试图解决这个问题,但只要我调用相同的路径,转换对象就是一样的。

您如何使用您设置的新参数更新模型?

0 个答案:

没有答案