How to bind to model with Angular Material ?

后端 未结 7 1697
花落未央
花落未央 2020-12-09 03:19

Take a look at this Plunker: https://plnkr.co/edit/yu95hUrKlUh4Ttc5SwYD?p=preview

When I\'m using , I am able to modify the valu

7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-09 04:14

    mat-button-toggle dont have a boolean value and [(ngModel)] won't work. See doc.

    These toggles can be configured to behave as either radio-buttons or checkboxes.

    a use case may be like this

    
      Toggle me!
      Toggle me!
      Toggle me!
    
    

    and change your boolean to myFlagForButtonToggle :string;

提交回复
热议问题