Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
45
help plis !! igx-switch change event example ?
posted

hello, i am using this element https://ko.infragistics.com/products/ignite-ui-angular/angular/components/switch.htmlCould someone help me with an example of how to execute a method in the change event.

Parents
No Data
Reply
  • 1320
    Verified Answer
    Offline posted

    Hello Erick,

    After investigating this further, I determined that your requirement could be achieved by binding a method to the change event the following way:

    <igx-switch checked="true" (change)="stateChanged($event)">

    The method stateChanged is defined in the ts file:

    public stateChanged(evt){

        if(evt.checked)

          console.log("Switch is now checked!");

        else {

          console.log("Switch is now unchecked!");

        }

      }

    I have prepared a sample, demonstrating the described behavior. Please test it on your side and let me know if you need additional information regarding this matter.

    Regards,

    Monika Kirkova,

    Infragistics

Children