Is there an after view change hook (much like didInsertElement)?

后端 未结 5 729
旧巷少年郎
旧巷少年郎 2021-02-06 08:07

Using the didInsertElement hook, I\'m able to do some jQuery plugin initialization that is needed. However, if a property changes, Ember re-renders the view, but do

5条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-06 08:39

    I came up with a slightly unusual way of tackling this problem. You can make a handlebars helper that fires an event when the view portion is re-rendered. I was using Bootstrap and jqPlot and needed to be able to tell, say, when the div was available to draw a chart into. With my helper you can do this:

    {{#if dataIsLoaded}}
        {{trigger didRenderChartDiv}}
        
    {{/if}}

提交回复
热议问题