Why are events not firing after the second render in Backbone.js?

前端 未结 2 1833
感情败类
感情败类 2021-02-07 20:25

I am creating an app in Backbone.js which has a parent and multiple child views. The child views contain links which they listen to and perform a function.

The parent st

2条回答
  •  自闭症患者
    2021-02-07 21:08

    A really common challenge. For future finders of this question, here's a great article about view rendering:

    You just need to make sure that delegateEvents is called to rebind the events on your subviews any time .html() runs. And since Backbone’s setElement calls delegateEvents already, a quick solution could look like this...

    http://ianstormtaylor.com/rendering-views-in-backbonejs-isnt-always-simple/

提交回复
热议问题