私はそれが簡単だと思われるものを理解しようとしています。ビュー用にこれを持っています(Flameを使用 - それがその一部であるかどうかはわかりません)。私がやろうとしているのは、ユーザーがクリックして利用可能な画像を選択できるように、1 から始まる番号付きのリンクのリストを表示することです。レイアウトは正常に機能し、すべての HTML は受け入れられますが、リンクをクリックすると
Uncaught TypeError: Object <(subclass of Ember.View):ember9452> has no method 'becomeKeyResponder'
と
App.Router:ember3456> could not respond to event App.ControllerA.jumpToImage in state root.visualGlossary.defaultState.
Google は、これらのエラーについて何も表示しません。
jumpToImage = Flame.View.extend({
layout: {left: 0, top: 5, height: 26, width: 'auto'},
classNames: 'image-links'.w(),
handlebars: "\
{{#each App.ControllerA.content.images}}\
{{#view App.arrayIndexer contentBinding='this'}}\
<a {{action 'App.controllerA.jumpToImage' }} {{bindAttr data-index='view._parentView.contentIndex'}}>{{view.test}}</a>\
{{/view}}\
{{/each}}\
"
}),
これをコントローラA(関連部品)として
App.controllerA = Em.ObjectController.extend({
imageIndex: 0,
//assume content.images is an valid enumerable
jumpToIImage: function(e){
this.set('imageIndex', $(e.target).data('index'));
}
)}
そしてコントローラーB
Sylvius.arrayIndexer = Ember.View.extend({
content: null,
test: function(){
return this.getPath('_parentView.contentIndex') + 1
}.property(),
jumpToImage: function(e){
Sylvius.vgDisplayController.set('imageIndex', $(e.target).data('index'));
}
})