typescript - Angular detect If checkbox is checked from the .ts -


i using angular 4 , have checkbox on component on component's html template file:

<input type="checkbox" (change)="canbeeditable($event)"> 

on component's .ts file have set's value true.

toggleeditable() {     this.contenteditable = true; } 

my problem want value changed if checkbox checked.

so like:

toggleeditable() {     if (checkbox checked) {       this.contenteditable = true;     } } 

how can this?

you need check event.target.checked solve issue. how can achieve that:

<input type="checkbox" (change)="toggleeditable($event)"> 

in component's .ts:

toggleeditable(event) {      if ( event.target.checked ) {          this.contenteditable = true;     } } 

Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -