emberjs.com에 표시되는 것처럼 검색 필드를 재현 해 보았습니다. 그러나 검색어를 입력하고 제출 버튼을 클릭하거나 제출 버튼을 클릭 할 때 내 코드에서 다음과 같은 오류 (Google 크롬)가 계속 발생합니다 :emberjs 이벤트를 처리하지 않았습니다
Uncaught Error: Nothing handled the event 'MyApp.ApplicationController.doSearch'.
나는이 오류가 발생하는 이유 누군가가 설명 할 수 http://jsfiddle.net/Mn2yy/
에서 볼 수 있습니다와 함께 일하고 내가 무엇을 위해 할 필요를 해결하기 위해 코드?
편집 :
searchpage 경로 :
MyApp.SearchRoute = Ember.Route.extend({
setupController: function(controller) {
controller.set('searchQuery', this.get('query'));
},
renderTemplate: function() {
this.render('searchpage', { into: 'container' });
}
});
와 ApplicationController :
MyApp.ApplicationController = Ember.Controller.extend({
// the initial value of the `search` property
search: '',
doSearch: function() {
// the current value of the text field
var query = this.get('search');
this.transitionToRoute('search', { query: query });
}
});
및 템플릿 : 링크가 다운되면, 이러한 코드의 관련 부분은 대한
<script type="text/x-handlebars" data-template-name="container">
<button {{action "doSearch" target="MyApp.ApplicationController"}} rel="tooltip-bottom" title="search" class="icon"><i class="icofont-search"></i></button>
{{view Ember.TextField valueBinding="MyApp.ApplicationController.search" action="MyApp.ApplicationController.doSearch"}}
{{outlet}}
</script>
<script type="text/x-handlebars" data-template-name="searchpage">
<h1>Search</h1>
{{#linkTo "home"}}Homepage{{/linkTo}}
<p>You searched for: "{{searchQuery}}"</p>
</script>
당신이 질문의 코드의 관련 부분을하시기 바랍니다 포함 할 수 있습니다? jsFiddle에 링크 만하지 마십시오. 링크가 죽으면 질문이 모두 손실됩니다. 또한 오류를 생성하기 위해 무엇을하는지 설명 할 가치가 있습니다 (상자에 텍스트를 입력하고 옆에있는 버튼을 클릭한다고 가정). –
done, thank you – xorinzor