Slider with TypeScript on propertyChange

Get the value of a slider on propertyChange

  •         
    <Page xmlns="http://schemas.nativescript.org/tns.xsd" loaded="pageLoaded">
      <StackLayout>
        <Slider id="yourSlider" value="" maxValue="20" minValue="1" />
      </StackLayout>
    </Page>	
    		
      
  •   
    import { EventData } from 'data/observable';
    import { Page } from 'ui/page';
    import { Slider } from "ui/slider";
    // Event handler for Page "loaded" event attached in main-page.xml
    export function pageLoaded(args: EventData) {
        // Get the event sender
        var page = <Page>args.object;
      	let slider = <Slider>page.getViewById('yourSlider');
     	slider.on('propertyChange', (args: PropertyChangeData) => {
          console.log(args.value);
        });
    }