# Enable button when toggle is check

**URL:** <https://forum.ionicframework.com/t/enable-button-when-toggle-is-check/118129>\
**Category:** ionic-v3\
**Created:** [January 13, 2018, 1:28pm UTC](https://forum.ionicframework.com/t/enable-button-when-toggle-is-check/118129 "2018-01-13T13:28:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![flosrn](https://avatars.discourse-cdn.com/v4/letter/f/4491bb/32.png) [@flosrn](https://forum.ionicframework.com/u/flosrn)\
**Post date:** [January 13, 2018, 1:28pm UTC](https://forum.ionicframework.com/t/enable-button-when-toggle-is-check/118129/1 "2018-01-13T13:28:06Z")

</div>

Hello, I want enable register button only when the toglle condition of use is checked like this :

![2018-01-13 14_20_13-WebJobbing - Ionic Lab](https://global.discourse-cdn.com/ionicframework/original/3X/8/d/8dbfb0018f301a09349f0c525abbaddac67e97e7.png)

register.html :

```auto
<ion-item class="CGU" no-lines>
     <ion-label class="CGU">I accept the conditions of use</ion-label> 
     <ion-toggle color="secondary" [checked]="isToggled" (ionChange)="notify()"></ion-toggle>
</ion-item> 

<button ion-button class="login" color="bleu" type="submit" (click)="register()" [disabled]="isToggled != true">Register</button>

```

register.ts :

```auto
public isToggled: boolean = false;

constructor(...) {...}

notify() {
    this.isToggled = !this.isToggled;
  }  

```

But it not working…

Nobody knows how to do it please?

---

<div class="post-metadata">

**Author:** ![user5555](https://avatars.discourse-cdn.com/v4/letter/u/8e7dd6/32.png) [@user5555](https://forum.ionicframework.com/u/user5555)\
**Post date:** [January 13, 2018, 1:55pm UTC](https://forum.ionicframework.com/t/enable-button-when-toggle-is-check/118129/2 "2018-01-13T13:55:16Z")

</div>

```auto
<ion-item class="CGU" no-lines>
     <ion-label class="CGU">I accept the conditions of use</ion-label> 
     <ion-toggle color="secondary" [(ngModel)]="agreements"></ion-toggle>
</ion-item> 

<button ion-button class="login" color="bleu" type="submit" (click)="register()" [disabled]="!agreements" Register</button>

```

---

<div class="post-metadata">

**Author:** ![flosrn](https://avatars.discourse-cdn.com/v4/letter/f/4491bb/32.png) [@flosrn](https://forum.ionicframework.com/u/flosrn)\
**Post date:** [January 13, 2018, 2:11pm UTC](https://forum.ionicframework.com/t/enable-button-when-toggle-is-check/118129/3 "2018-01-13T14:11:05Z")

</div>

> [@user5555](#):
>
> !agreements

Not working : Uncaught (in promise): Error: \n ngModel cannot be used to register form controls with a parent formGroup directive. Try using\n formGroup’s partner directive "formControlName" instead.

I think I can’t use Ngmodel because I already use that in the rest of my code for something else…

I think I must use [checked] and (ionChange)

---

<div class="post-metadata">

**Author:** ![flosrn](https://avatars.discourse-cdn.com/v4/letter/f/4491bb/32.png) [@flosrn](https://forum.ionicframework.com/u/flosrn)\
**Post date:** [January 13, 2018, 2:22pm UTC](https://forum.ionicframework.com/t/enable-button-when-toggle-is-check/118129/4 "2018-01-13T14:22:00Z")

</div>

ok it work like that :

```auto
<ion-item class="CGU" no-lines>
     <ion-label class="CGU">I accept the conditions of use</ion-label> 
     <ion-toggle color="secondary" [checked]="isToggled" (ionChange)="notify()"></ion-toggle>
</ion-item> 

<button ion-button class="login" color="bleu" type="submit" (click)="register()" [disabled]="!isToggled">Register</button>

```

quite simply…

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:54pm UTC](https://forum.ionicframework.com/t/enable-button-when-toggle-is-check/118129/5 "2021-07-19T21:54:58Z")

</div>

Closed on July 19, 2021, 9:54pm UTC


