Should we wait for DOM to load before calling ko.applyBindings

后端 未结 1 727
暗喜
暗喜 2021-01-18 08:08

As per the title, is it necessary to wait for the DOM to load before calling ko.applyBindings or will Knockout handle this automatically?

I.e - am I saf

1条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-18 08:12

    No KO doesn't handle this automatically (so the self invoking function would work only at the bottom your page), you have to wait for the DOM loaded with the ko.applyBindings call.

    From the documentation:

    To activate Knockout, add the following line to a

提交回复
热议问题