6

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}}>
3
  • Can you add a MCVE? Commented Jul 13, 2018 at 8:28
  • I already have isEnabled variable that sets value based on different condition onInit, later i want to check and uncheck the checkbox based on checkbox value Commented Jul 13, 2018 at 8:55
  • $('input.type_checkbox[value="6"]').prop('checked', true); I need this condition in typescript. please help me Commented Jul 13, 2018 at 9:14

2 Answers 2

6

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}}>
Sign up to request clarification or add additional context in comments.

Comments

5
[checked] = "isEnabled()"

add function

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.