我有一个基于 ember.js 路由器的应用程序,需要在转换到不同的应用程序状态之前对操作执行一些基本逻辑。我的按钮的 Action 看起来像
<button {{action doSomethingThenNavigate target="view"}}>Compute the Change</button>
我的 Ember.View
子类上会有一个 doSomethingThenNavigate
方法。
我的问题是我不知道如何让路由器从 View 中触发更改,我试过了
doSomethingThenNavigate: ->
console.log "computing something..."
App.router.showCat()
其中 showCat()
是我路由器上的一个方法。这行不通。
我有一个 jsfiddle 来举例说明问题 HERE
最佳答案
关于javascript - Ember.js 路由器,从 View 获取路由器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11937905/