dove4evr
dove4evr

Reputation: 83

Enable and Disable input field in ionic

I have an input field
<input type="text" ng-model="setting.email_id" placeholder="Email Id" class="inputBox">.

I have an icon for edit next to this field :
<i class="fa fa-pencil-square-o editzoom" ng-click="editEmail()"></i>

I want to the input field to be in disabled state and only when this icon is clicked, i want to enable the input field.

How do u achieve this in ionic framework?

Upvotes: 0

Views: 6630

Answers (1)

danicomas
danicomas

Reputation: 84

You could have:

<input type="text" ng-model="setting.email_id" placeholder="Email Id" class="inputBox" ng-disabled="!editEmail">

<i class="fa fa-pencil-square-o editzoom" ng-click="editEmail()"></i>

$scope.editEmail = false;

editEmail(){
   $scope.editEmail = true;
}

Upvotes: 2

Related Questions