jeudi 27 octobre 2016

Pull item after inject.service()

I have a service

export default Ember.Service.extend({
products: [],
add(product) {
   this.get('products').pushObject(product);
},

in template I call it

 <a href=" ">

and my component controller has this action

  searchProduct: Ember.inject.service(),
  ...
  ...

    add() {
  this.get('searchProduct').add(this.get('item'));
}

So when I click and move to route - products I am not able to pull what I injected. My products controller has the following.

searchProduct: inject.service(),
onSearch: function() {
  return this.get('searchProduct.products.length');
}),

What I am missing? Thank you!




Aucun commentaire:

Enregistrer un commentaire