Availability of UI elements in Marionette.View

前端 未结 3 1498
予麋鹿
予麋鹿 2021-02-13 11:47

I\'d just like to understand the decisions behind Backbone.Marionette\'s view regarding UI elements. When instantiating a Marionette.View on an existing DOM element, like this:<

3条回答
  •  悲哀的现实
    2021-02-13 12:01

    Attaching a view to an existing element is the exception. The normal view lifecycle involves calling render, and without doing that there would be nothing for the UI elements to bind to.

    Just call this.bindUIElements() in your initialize method when you need to attach a view to an existing element.

提交回复
热议问题