question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Data binding access Array item via binded index does not work as mentioned in the docs

See original GitHub issue

https://docs.nativescript.org/core-concepts/data-binding#supported-expressions Referring to array access

Demonstration: https://play.nativescript.org/?template=play-js&id=YFnWeE

For some reason, this is not working as mentioned in the docs.

It works fine if I uses list[0] (if I pass actual number when I bind it)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
shiv19commented, Jul 26, 2018

@NickIliev Thanks to @PeterStaev, now I know to bind to variable index, of an array, Demo: https://play.nativescript.org/?template=play-js&id=YFnWeE&v=4

We can use {{ list index, list[index] }} to bind it. i.e., specify the variables and then use it.

This part of the docs talks about it, https://docs.nativescript.org/core-concepts/data-binding#using-expressions-for-bindings

Closing this issue.

0reactions
lock[bot]commented, Aug 26, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bind template item to the index of the array in KnockoutJS
Is there a way to bind to the index of the item in the array using KnockoutJS? It would be a shame if...
Read more >
Data binding - Polymer Project
A data binding connects data from a custom element (the host element) to a property or attribute of an element in its local...
Read more >
The "foreach" binding - Knockout.js
The foreach binding duplicates a section of markup for each entry in an array, and binds each copy of that markup to the...
Read more >
Layouts and binding expressions | Android Developers
The Data Binding Library automatically generates the classes required to bind the views in the layout with your data objects. Data binding ......
Read more >
Binding data and configuration options - IBM
The binding object, if defined, provides access to data that is bound to a ... function is not called, because the view is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found