This is a migrated thread and some comments may be shown as answers.

Binding to properties in NativeScript

1 Answer 29 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tigga
Top achievements
Rank 1
Iron
Tigga asked on 15 Feb 2016, 06:25 PM

On pageLoaded I bind the xml page binding Context

  page.bindingContext = viewModel;

I view a property in the .js with this statement and it displays correctly with the correct data.

  dialogs.alert(viewModel.jobItem["OpDtlDesc"]);

In the xml I readily bind to the properties with this syntax where jobItem is one of the objects in viewModel.

  <Label text="{{ jobItem.OpDtlDesc }}" />   

I would like to bind to the property in the same fashion as I do in the javascript. 

   <Label text='{ jobItem["OpDtlDesc"] }}' />  

 How do I do this? 

1 Answer, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 18 Feb 2016, 07:37 AM
Hi,

Generally within xml everything is a string therefore you do not need quotes in property setters. So for your example your xml should be similar to the following:

<Label text="{{ jobItem[OpDtlDesc] }}" />

Regards,
Nedyalko Nikolov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Tigga
Top achievements
Rank 1
Iron
Answers by
Nedyalko Nikolov
Telerik team
Share this question
or