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

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -