Wil*_*Wit 4 javascript closures action ember.js
恩伯1.13.10
我想试试闭包动作,所以我定义了一条路线:
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
doSave() { ... }
}
});
Run Code Online (Sandbox Code Playgroud)
和模板:
{{my-component onSave=(action 'doSave')}}
Run Code Online (Sandbox Code Playgroud)
但我收到错误消息: An action named 'doSave' was not found in (generated test.index controller).
但是它在路线上定义.鉴于控制器在Ember中被弃用了,我希望应该在路由而不是控制器上定义动作.是否有特定原因可以在控制器上定义关闭操作?