Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkedChange event is not working #91

Open
murat199 opened this issue Jul 16, 2018 · 3 comments
Open

checkedChange event is not working #91

murat199 opened this issue Jul 16, 2018 · 3 comments

Comments

@murat199
Copy link

murat199 commented Jul 16, 2018

I am using typescript template and "checkedChange" event is not working on my xml page.

image

image

image

image

main-page.xml-->

<Page loaded="pageLoaded" class="page" xmlns="http://schemas.nativescript.org/tns.xsd" xmlns:CheckBox="nativescript-checkbox">
    <Page.actionBar>
        <ActionBar title="My App" icon="" class="action-bar">
        </ActionBar>
    </Page.actionBar>
    <CheckBox:CheckBox checkedChange="{{ onCheckedChange }}" text="checkedChange event is not working" checked="false"/>
</Page>

main-view-model.ts-->

import { Observable } from 'data/observable';
import { ObservableProperty } from "../../common/observable-property-decorator";
import { Page } from 'ui/frame';

export class HelloWorldModel extends Observable {

  @ObservableProperty() textFieldValue: string = "";
  private _page:Page;

  constructor(page) {
    super();
    this._page=page;
  }
  onCheckedChange(){
      console.log("checked change");
  }
}

main-page.ts -->

import { EventData } from 'data/observable';
import { Page } from 'ui/page';
import { HelloWorldModel } from './main-view-model';

export function pageLoaded(args: EventData) {
  let page = args.object;
  page.bindingContext = new HelloWorldModel(page);
}
@murat199 murat199 changed the title checkedChange event not working checkedChange event is not working Jul 16, 2018
@KirilOkun
Copy link

Got the same problem on Android (haven't tested on iOS yet). checkedChange does not fire while tap fires just fine.

XML:

<Page
    class="page"
    loaded="onPageLoaded"
    xmlns="http://schemas.nativescript.org/tns.xsd"
    xmlns:cb="nativescript-checkbox"
    >
...
<cb:CheckBox id="testbox" checked="false" text="Test checkbox" color="#777777" fillColor="#0e79b2" fontSize="30"  boxType="circle" loaded="onCheckboxLoaded" checkedChange="onCheckboxChanged"></cb:CheckBox>

NS v 4.2
tns-core-modules v 4.2.1
typescript v 3.1.3

@kdmakwana43
Copy link

kdmakwana43 commented Mar 27, 2020

Event should be in brackets

<CheckBox 
(checkedChange)="onChange($event)"
  checked="false"> 

@mrwrighty
Copy link

checkedChange not firing in Javascript, but tap does. Have tried brackets around the event, but this causes a syntax error.

(checkedChange)="checkTap"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants