Pedro Pam
Pedro Pam

Reputation: 405

Duplicate components in knockoutjs

I have a HTML component called by Knockoutjs, and I want to duplicate it many times as user ask. Was exploring the foreach option but didn't get results.

<input data-bind="value: howMany">

<div data-bind="component: {name: 'codebar', params: lay }"></div>

Upvotes: 0

Views: 79

Answers (1)

Pedro Pam
Pedro Pam

Reputation: 405

Ok, so I found this amazing tool that works perfect for this or other situations that you just want to repeat elements with a easy and clean code.

Is a Repeat bind that you can add to your project:

https://github.com/mbest/knockout-repeat

Hope this may be useful for someone too.

Upvotes: 2

Related Questions