Bind a model property to mdb-checkbox

Viewed 64

I have an mdb-checkbox I want to bind to a field in my member component property named questionAskedOnMyTags.

So here's what I got:

export interface Member {    
    questionAskedOnMyTags: boolean;
...


export class MemberEditComponent implements OnInit {
  member: Member;  

And the checkbox:

<mdb-checkbox [(ngModel)]='member.questionAskedOnMyTags' [default]="true" name='questionAskedOnMyTags'>A question is asked according to my tags</mdb-checkbox>             
      

This gives the following error:

core.js:6498 ERROR Error: Uncaught (in promise): Error: No value accessor for form control with name: 'questionAskedOnMyTags'
Error: No value accessor for form control with name: 'questionAskedOnMyTags'  

I realise it can't bind the value, but I don't understand what's the correct way to bind it.

0 Answers
Related