faulknercs / Knockstrap

Knockout bindings to twitter bootstrap 3
faulknercs.github.io/Knockstrap/
MIT License
142 stars 37 forks source link

Is there a way to use foreach in data-binding of modal body object? #49

Closed ZackBoyd closed 8 years ago

ZackBoyd commented 8 years ago

I would like to pass a ko observable array to my template for the modal body and use foreach to populate the body with a row for each item in the observable array (I'm displaying search results for a location in the modal). I've been able to get the modal to show up and populated data in the header and modal body with a single item example, but haven't been able to get it to work with foreach and was wondering if it is supported?

faulknercs commented 8 years ago

Hello,

Yes, it should be supported. Please, see this examples: https://jsfiddle.net/faulknercs/dqqc807f/ https://jsfiddle.net/faulknercs/26sde9jj/ https://jsfiddle.net/faulknercs/fpqw4r3d/ Hope, they will help you.

ZackBoyd commented 8 years ago

Awesome, those examples were very helpful. I was trying to go off the Knockout template docs and take the approach of the #2 fiddle, but I didn't have it quite right. Thanks again and thanks for putting out these bindings.

faulknercs commented 8 years ago

You are welcome!