javascript - How to tell if Ng-Repeat has printed x items -


how can tell if there 1 item displayed ng-repeat? like, if ng-repeat items === 1: something.

<div ng-controller="mycontroller2"> <form ng-submit="submit()">    {% csrf_token %}    search name:    <input ng-model="artistname" />    <input type="submit" value="submit" /> </form> <table>    <tr ng-repeat="name in names | filter:artistname | limitto:10">        <!-- if number of "name" === 1 want form submitted -->        <td ng-hide="!artistname">            <a href="" ng-click="submit()">            {({ name })}            </a>        </td>    </tr> </table> 

this code reads input user display list of links submit form. want form submit automatically when initial list of artist names displayed ng-repeat down 1, since there can 1 dataset database @ point anyway.

add in form block:

<div ng-if="names.length == 1">     <script type="text/javascript">     $("#myform").submit();      </script> </div> 

Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -