mardi 10 novembre 2015

Nothing handled the action Emberjs 2

I have a application when do a search an return some datas to show for my user. When I click to do a search I receive this error and the model object inside the actions, don't show the model with informations filled. Follow error and code.

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.

Component

export default Ember.Component.extend({
    actions: {
        searchBooking(booking) {
            console.log('Component - 6', booking);
            this.sendAction('doSearchBooking', booking);
            this.set('booking', {});
        }
    }
});

Form component

<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>

Calling the component

{{search-booking booking=model.booking searchBooking='doSearchBooking'}}

My controller

export default Ember.Controller.extend({
    actions: {
        doSearchBooking(booking) {
            console.log('controller - 6');
            this.sendAction('searchBooking', booking);
        }
    }
});

And my Route

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();
        }
    }
});

Aucun commentaire:

Enregistrer un commentaire