EmberJS, polling, update route's model, re-render component

前端 未结 2 725
臣服心动
臣服心动 2021-01-31 23:40

I\'ve been looking for mechanism to update the model of a Route, and has the Component (called from within the template associated with that route) reacts to that event, and re-

2条回答
  •  后悔当初
    2021-02-01 00:11

    You just need to watch the model. No?

    update: function() {
      var data = this.get('model').map(function(sales) {
        return sales.get('amount');
      });
    
      d3.select(this.$()[0]).selectAll('div.h-bar')
        .data(data)
        .call(this.get('chart'));
    }.property('model')
    

提交回复
热议问题