Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not require data-init attribute if a template has been specified #11

Closed
ErikSchierboom opened this issue Apr 27, 2015 · 0 comments
Closed
Assignees

Comments

@ErikSchierboom
Copy link
Owner

At the moment, you have to do this:

<ul data-bind="foreachInit: { name: 'personTemplate', data: persons }">  
  <li data-init data-bind="init, text: name">Michael Jordan</li>
  <li data-init data-bind="init, text: name">Larry Bird</li>
  <li data-init data-bind="init, text: name">Magic Johnson</li>
</ul>

<script type="text/ko-template" id="personTemplate">
  <li data-template data-bind="text: name"></li>
</script>

However, as the template has been explicitly specified, the data-init attribute is not necessary. You should be able to do this:

<ul data-bind="foreachInit: { name: 'personTemplate', data: persons }">  
  <li data-bind="init, text: name">Michael Jordan</li>
  <li data-bind="init, text: name">Larry Bird</li>
  <li data-bind="init, text: name">Magic Johnson</li>
</ul>

<script type="text/ko-template" id="personTemplate">
  <li data-template data-bind="text: name"></li>
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant