Comment appeler la méthode d'un composant à partir d'un contrôleur

J'ai un composant qui représentent une carte et après une action dans mon contrôleur, je tiens à appeler une méthode sur le composant pour le centre de la carte. Le code ressemble à ceci

App.PlacesController = Ember.Controller.extend({
  actions : {
    centerMap : function () {
        //how to call from here to GoogleMapComponent.centerMap ??
    }
  }
});


App.GoogleMapComponent = Ember.Component.extend({
  centerMap : function () {
  }
});

modèle

{{google-map}}
<button {{action "centerMap"}}>Center Map</button>

J'ai trouvé une solution de contournement, mais je ne pense pas que ce soit la Braise moyen de le faire.

{{google-map viewName="mapView"}}
<button class="center-map">Center Map</button>

App.PlacesView = Ember.View.extend({
  didInsertElement : function () {
    this.$(".center-map").click(this.clickCenterMap.bind(this));
  },

  clickCenterMap : function () {
    this.get("mapView").centerMap();
  }
});
InformationsquelleAutor axelhzf | 2013-10-27