IvRRimUm IvRRimUm - 1 year ago 125
TypeScript Question

How to pass an argument into propertyChange?

So the title is pretty self explanatory.

<Switch *ngIf="item.type=='checkbox'" [item]="item" (propertyChange)="onAttributeSwitchChange" row="1" checked="false"></Switch>

public onAttributeSwitchChange(args: observable.PropertyChangeData) {

//console.log(args.propertyName + " has been changed and the new value is: " + args.value);
if (args.propertyName === "checked") {
} else {


I need to get the
into the

And also, i need to make
working, because its not now(When i change value the
doesn't fire).

Reference: https://github.com/NativeScript/NativeScript/issues/1353

Answer Source

Thanks @alexis-cramatte for the tip :)

But here's what worked:

In (Nativescript) NG2 you can access the properties by the ID. <Switch #switch *ngIf="item.type=='checkbox'" row="1" checked="false" (checkedChange)="onAttributeSwitchChange(switch.checked)"></Switch>

switch - Sets the ID

and then you can use the properties of the object by - switch.[propertyhere] - for example: switch.checked

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download