Checkbox checked if boolean is true with Angular2

前端 未结 3 1040
灰色年华
灰色年华 2021-01-03 22:19

I would like to know how to make a checkbox checked if the value is true, and unchecked if false with Angular2.

Adult 

        
3条回答
  •  遥遥无期
    2021-01-03 22:59

    Try the following :

    
    

    If you are using ngModel :

    When ngModel is used in a form it won't work. However, you should use [ngModelOptions] attribute like

     
    

提交回复
热议问题