Angular check ng-repeat value

http://jsfiddle.net/sevensnake/6mw5v9pt/1/

ok here is a good one. Is there a way to check the value inside ng-repeat and if it is the same give alert or ng-readonly. anything that will alert the user you put in the same value that exists in the ng-repeat.
LVL 9
Seven priceFull StackAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Alexandre SimõesManager / Technology SpecialistCommented:
Forget about the ng-repeat, use the model instead.
just create a function that validates the input value against the model variable.

I have to go but it's just a matter of validating on blur if the value the user entered exists in the $scope.choices values.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Julian HansenCommented:
You can use ng-blur or ng-change

Angular
HTML
<div ng-controller="MainCtrl">
    <div>  
    </div>
    <div ng-repeat="row in choices">
        <input type="text" class="form-control" ng-model="row.id" />
        <input type="text" class="form-control" ng-model="row.vallues" /> 
       
    <br />
    </div>
    <div style="margin-top:50px;">  <input type="text" class="form-control" ng-model="checkval" ng-blur="inList()"/> Type value same as ng-rpeat value cause alert or validation</div>
   <!-- <div>Total of all rows: {{row |total}}</div>-->
    <div ng-show="checkValError">Input cannot be in list</div>
</div>

Open in new window

app.controller('MainCtrl', function ($scope) {
      
      $scope.choices = [
            { id: 'Choice1', vallues: 'test' },
            { id: 'Choice7', vallues:'test' }
        ];
	  $scope.checkval = '';
      $scope.checkValError = false;
      $scope.inList = function () {
      for(var i in $scope.choices) {
        $scope.checkValError = false;
        if ($scope.choices[i].id == $scope.checkval) {
          $scope.checkValError = true;
          break;
        }
      }
     }

Open in new window

Seven priceFull StackAuthor Commented:
tks
Julian HansenCommented:
You are welcome
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Angular

From novice to tech pro — start learning today.