Reapply bindings in knockout

后端 未结 3 1552
名媛妹妹
名媛妹妹 2021-01-12 04:56

I basically want to reapply bindings on the same page for the different objects, but there is strange behavior. After I reapply the binding, the list of items is lost.

3条回答
  •  难免孤独
    2021-01-12 05:43

    you can bind the same viewmodel to different elements, you need specify the element you want to apply your binding to.

    ko.applyBindings(vm, $('#yourul'));
    
    ko.applyBindings(vm, $('#div'));
    

提交回复
热议问题