Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

angularjs

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

like image 620
Angular_Newbie Avatar asked May 05 '15 17:05

Angular_Newbie


2 Answers

You can individually disable all the form elements as suggested in the current answer/comments, or you can wrap all of your form elements in a <fieldset> (more info) tag and then enable/disable everything in one step:

<form>
  <fieldset ng-disabled="myBooleanValue">
    <input type="text">
  </fieldset>
</form>
like image 166
Sunil D. Avatar answered Oct 18 '22 05:10

Sunil D.


You can add ng-disabled="someBoolean" to your form elements, and set someBoolean to true when you click a button.

https://docs.angularjs.org/api/ng/directive/ngDisabled

like image 23
azium Avatar answered Oct 18 '22 04:10

azium