Writing a helper that produces bound results?

前端 未结 3 1757
忘掉有多难
忘掉有多难 2020-12-09 18:31

I have a date/time formatting helper but what it produces does not update when the underlying property changes. This is not a surprise, but does anyone know how to produce

3条回答
  •  青春惊慌失措
    2020-12-09 19:29

    Not sure if this applies to this particular question, but I also created helpers in views and wanted the values to update when data in the Ember.js view changed. The way I solved this problem was to write an observer on the values I wanted changed and used jQuery to update the specific value.

    For example (in Coffeescript):

    ...
    
    attrObserver: Ember.observer(() ->
      $("#attrId").text(this.get("attr"))
    
    ...
    

提交回复
热议问题