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

"foreach" binding doesn't work with arrays of primitives #3

Closed
pago opened this issue Jan 20, 2014 · 0 comments
Closed

"foreach" binding doesn't work with arrays of primitives #3

pago opened this issue Jan 20, 2014 · 0 comments
Assignees
Labels
bug
Milestone

Comments

@pago
Copy link
Collaborator

@pago pago commented Jan 20, 2014

At the moment, it is not possible to use a "foreach" binding in a template if it iterates over an array (or ObservableList) that is not an object (such as an array of strings or numbers).

This happens because of how we create a new context (by creating a new object whose prototype is the original data). At that point, we need to verify that what we received actually is an object and create one if it isn't.

Example:

<ul bind="
    foreach: component.values
">
    <template>
        <li><span bind="text: $item"></span></li>
    </template>
</ul>

The above example doesn't work if the values property is an Array/ObservableList of Strings.

This issue should be fixed in jidejs/ui/bind.js createContext function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.