0
我有一個應用程序,當做搜索返回一些數據顯示給我的用戶。當我點擊進行搜索時,我收到這個錯誤和動作中的模型對象,不要顯示填充了信息的模型。按照錯誤和代碼。沒有處理的行動Emberjs 2
Uncaught Error: Nothing handled the action 'doSearchBooking'. If you did handle the action, this error can be caused by returning true from an action handler in a controller, causing the action to bubble.
組件
export default Ember.Component.extend({
actions: {
searchBooking(booking) {
console.log('Component - 6', booking);
this.sendAction('doSearchBooking', booking);
this.set('booking', {});
}
}
});
表單組件
<form class="row" >
<div class="col-sm-3">
{{input type='text' value=booking.doc1 class='form-control'}}
</div>
<div class="col-sm-2">
{{input type='text' value=booking.doc2 class='form-control'}}
</div>
<div class="col-sm-2">
{{input type='text' value=booking.doc3 class='form-control'}}
</div>
<div class="col-sm-3">
{{input type='text' value=booking.idDoc class='form-control'}}
</div>
<div class="col-sm-2 btn-form-pesquisa">
<button class="btn btn-primary" {{action 'searchBooking' booking}}>Search</button>
</div>
</form>
調用組件
{{search-booking booking=model.booking searchBooking='doSearchBooking'}}
我控制器
export default Ember.Controller.extend({
actions: {
doSearchBooking(booking) {
console.log('controller - 6');
this.sendAction('searchBooking', booking);
}
}
});
我的路線
export default Ember.Route.extend({
model() {
return Ember.RSVP.hash({
data: this.store.createRecord('booking'),
booking: {}
});
},
actions: {
searchBooking(booking) {
let newSearch = this.store.createRecord('booking', {
doc1: booking.doc1,
doc2: booking.doc2,
doc3: booking.doc3,
idDoc : booking.idDoc
});
newSearch.save();
}
}
});
我更改發送操作和錯誤繼續 – flpms
您確定您的代碼沒有錯字嗎?錯誤的行爲名稱中有空格 - 「doSearch Booking」。 –
我確定,我在Ember github上看到很多問題,與此有關。 – flpms