AngularJS toggle button

前端 未结 6 1189
不知归路
不知归路 2021-02-01 03:41

I am trying to create a toggle button in Angular. What I have so far is:


      
6条回答
  •  無奈伤痛
    2021-02-01 04:20

    
    

    Then style the checkbox like a button.

    if the toggle needs to do more things, add the following to your patient class:

    class Patient {
      constructor() {
        this.archived = false;
      }
      ...
      get angularArchived() {
        return this.archived;
      }
      set angularArchived(value) {
        if (value !== this.archived) {
          toggleArchived(value);
        }
        this.archived = value;
      }
    }
    

    then use

    
    

提交回复
热议问题