-1

I am working on grid and I have two textboxes in html and i use angularjs. How can use mutual exclusion for my textboxes. If I input some value in first textbox, second textbox must be disabled. If I input some value in second textbox, first textbox must be disabled. Thanks

Community
  • 1
  • 1
oknevermind
  • 101
  • 3
  • 17

2 Answers2

3

Working code...

<div ng-app>
        <input type="text" ng-model="test" ng-disabled="test1">
        <input type="text" ng-model="test1" ng-disabled="test">
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.3/angular.min.js"></script>

JsFiddle

nisar
  • 1,055
  • 2
  • 11
  • 26
1

This can be solved with ngModel and ngDisabled.

<input ng-model="vm.input1" ng-disabled="vm.input2">
<input ng-model="vm.input2" ng-disabled="vm.input1">

DEMO

GG.
  • 21,083
  • 14
  • 84
  • 130