Auto-generate Div Ids for Bootstrap Accordion Menu binding with Knockout js

前端 未结 1 839
孤街浪徒
孤街浪徒 2020-12-21 23:52

I am creating a side menu using bootstrap accordion collapse and making use of knockout js binding. My problem is in assigning the right HTML element ids for toggle and coll

1条回答
  •  盖世英雄少女心
    2020-12-22 00:22

    well i already done something like this before hope this helps

        
    

    Let me explain here :

    You just need to create dynamic id and href in oder to work with this stuff . Well lucky you have one loop over if incase there exists multiple loops use $parentContext.index() and so on .

    You just need to use attr to create dynamic id and href using $index() which gives you unique id everytime it loops .

    0 讨论(0)
提交回复
热议问题