Modifying data within an AngularJS application that is designated as read-only can be challenging due to the framework's encapsulation and data-binding mechanisms but we can leverage AngularJS's ng-readonly Directive:
The ng-readonly directive in AngularJS allows you to dynamically set the readonly attribute on input elements based on an expression. By binding this directive to a model property, you can control the read-only state of form controls:
<input type="text" ng-model="testViewModel.name" ng-readonly="makeReadOnly" />
In the associated controller, you can toggle the makeReadOnly property to enable or disable the read-only state:
$scope.makeReadOnly = true;
$scope.edit_Click = function() {
$scope.makeReadOnly = false;
};
$scope.update_Click = function() {
$scope.makeReadOnly = true;
};