TamilRoja
TamilRoja

Reputation: 165

checked and unchecked checkbox dynamically using angular

I want to make the checkbox checked and unchecked from the function based on value , if suppose checkbox value is 120, how to make that checkbox checked

<input type="checkbox" [checked] = "isEnabled" value={{rowData.FILE_LOAD_ID}} id={{rowData.FILE_LOAD_ID}}>

Upvotes: 6

Views: 15385

Answers (2)

Woworks
Woworks

Reputation: 1468

[checked] = "isEnabled()"

add function

isEnabled() {  
return this.someValue === 120; 
}

Upvotes: 5

Krishna Rathore
Krishna Rathore

Reputation: 9687

you can use [checked] = "rowData.FILE_LOAD_ID==120"

<input type="checkbox" [checked] = "rowData.FILE_LOAD_ID==120" value={{rowData.FILE_LOAD_ID}} id={{rowData.FILE_LOAD_ID}}>

Upvotes: 6

Related Questions