lundi 20 février 2017

how to send data from component to route ember?

I am using ember js of version 2.10 And i am trying to send data from component to route.

Here is my component template

<div class="pull-right search-section">
    <form class="form-inline search-box" >
      <button type="submit" class="btn"><i class="glyphicon glyphicon-search"></i></button>
      <div class="form-group">
        
      </div>
    </form>
    <a href="#" class="link-advance-search">Advance Search</a>
</div>

Now I am trying to send data to route from component js file with following code import Ember from 'ember';

export default Ember.Component.extend({
  save: function () {
        var search = this.get('search');
        console.log(this.sendAction('saveAction',search));
  }
});

And trying to get at route js file with following code

import Ember from 'ember';
export default Ember.Route.extend({  
    actions: {
        saveAction: function(search_string){
            alert('fhdishf');
        }
    }
});

But unfortunately did not getting anything.

Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire