简体   繁体   中英

How correctly use haml template in knockoutjs foreach binding?

I can't get div element ".some" with text "Some" with such haml template and knockout foreach binding. Thus, div element ".steph" forms correctly.

.steps{data:{bind: "foreach: steps"}}
  .step
    .steph.editable.act{data:{bind: "text: name"}}
      .some Some

Is it possible?

You can pretty much do it with ko.haml extention by Martin Naumann..

Just call this in your JavaScript

ko.setTemplateEngine(new ko.hamlEngine());

and it will allow you to bind knockout attributes to Haml template.

Step by step implementation guide is given on github page.

https://github.com/centralway/ko.haml.js

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM