1
<input ng-model="email" type="text" class="marginHalf" ng-hide="email==''" readonly>

When on edit button click, Show this so user ca add an email.

Sasi Pranay
  • 327
  • 1
  • 3
  • 7
  • I guess what you need is `ngReadonly`. Check [HERE](https://code.angularjs.org/1.2.32/docs/api/ng/directive/ngReadonly) please – Batu.Khan Nov 29 '18 at 10:17

1 Answers1

0

You need to have a flag in your controller to toggle on and off when your edit button is clicked.

$scope.editMode = false;
$scope.onEditButtonClick = function(){
    $scope.editMode = true;
}

then you use a condition that checks this variable but I recommend using ng-if instead.

<input ng-model="email" type="text" class="marginHalf" ng-if="editMode" readonly>

Here is the difference between ng-if and ng-show/ng-hide.

holydragon
  • 6,158
  • 6
  • 39
  • 62