Disable submit button when duplicates in ng-repeat
<p>In extending to the <a href="https://stackoverflow.com/questions/29707131/check-duplicate-values-between-multiple-inputs-and-show-error-message">question</a> how to disable submit button or make form invalid if i have any duplicates</p>

<p><strong>Got Solution</strong> : here is my code </p>

<p>HTML</p>

<pre><code>&lt;a href="javascript:void(0);" class="btn btn-primary" ng-disabled="redemptionStep1.$invalid"&gt;Submit&lt;/a&gt;
</code></pre>

<p>JS</p>

<pre><code>$scope.myform.$setValidity('invalid',!((sorted[i-1] &amp;&amp; sorted[i-1].voucherCode == sorted[i].voucherCode) || (sorted[i+1] &amp;&amp; sorted[i+1].voucherCode == sorted[i].voucherCode)));
</code></pre>