propertyChangeEvent problem

nativescriptrocks
nativescriptcore
plugins
android

#1

i have 2 text fields and only one field property change event i need to trigger i.e first text field only not another one.
but i couldnt find any solutions or documents to achieve this. whenever i enter text in both the fields. property change event is triggering can anyone help me out .

u can go to playground link below

<Page loaded="pageLoaded" class="page" xmlns="http://www.nativescript.org/tns.xsd">

	<ActionBar title="Home" class="action-bar">
	</ActionBar>
	<ScrollView>
		<StackLayout class="home-panel">
			<TextField text="{{ textFieldValue }}" propertyChangeEvent="{{ textchange }}" hint="Enter text..." />
			<TextField text="{{ textField }}" hint="Enter text..." />
			<Button text="Button" tap="{{ onButtonTap }}" />
		</StackLayout>
	</ScrollView>
</Page>
var observableModule = require("data/observable");

function HomeViewModel() {
  var viewModel = observableModule.fromObject({
  
    textFieldValue: "",

/*  // this code was not working
    textchange: viewModel.addEventListener(observableModule.Observable.propertyChangeEvent, (args) => {
      // args is of type PropertyChangeData
      console.log("propertyChangeEvent [eventName]: ", args.eventName);
      console.log("propertyChangeEvent [propertyName]: ", args.propertyName);
      console.log("propertyChangeEvent [value]: ", args.value);
      console.log("propertyChangeEvent [oldValue]: ", args.oldValue);
      console.log("propertyChangeEvent [object]: ", args.object);
    }),

    */
       
  });



// this will exceute on any property change in page 
  viewModel.addEventListener(observableModule.Observable.propertyChangeEvent, (args) => {
    // args is of type PropertyChangeData
    console.log("propertyChangeEvent [eventName]: ", args.eventName);
    console.log("propertyChangeEvent [propertyName]: ", args.propertyName);
    console.log("propertyChangeEvent [value]: ", args.value);
    console.log("propertyChangeEvent [oldValue]: ", args.oldValue);
    console.log("propertyChangeEvent [object]: ", args.object);
  });





  return viewModel;
}

module.exports = HomeViewModel;

#2

i found solution for textchange by getting value by id and calling a function.

**>but how to handle property change event for one field???**


#3

Property change events were used in {N} 2.x. Starting 3.x it is handled differently, checkout the breaking changes doc here.