How to make an angular form read only and make it editable with edit button?

后端 未结 3 2481
面向向阳花
面向向阳花 2021-02-19 22:22

Is there a way to make the entire Angular form read only and then editable when clicking edit?

3条回答
  •  既然无缘
    2021-02-19 22:55

    This is how i do it, i create a css class using pointer-events, pointer-events: none prevents click, state or cursor options so:

    .formdisabled
    {
      pointer-events: none;
      opacity: 0.8;
    }
    

    Then in view i use ng-class on form like this:

    In view add button to play with the disableForm:

    Show/Hide Form
    

    Change opacity value if needed.

提交回复
热议问题