Binding to properties in NativeScript

2 posts, 0 answers
  1. Tigga
    Tigga avatar
    5 posts
    Member since:
    Feb 2015

    Posted 15 Feb Link to this post

    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.


    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? 

  2. Nedyalko Nikolov
    Nedyalko Nikolov avatar
    871 posts

    Posted 18 Feb Link to this post


    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] }}" />

    Nedyalko Nikolov
    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
Back to Top