Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<br> tag in ng-repeat angular-js

I have an ng-repeat <ul> list. I want to insert <br> after each <ul> tag. How can i do this?.

Here is my code

<ul class="list" ng-repeat="result in results">
    <li class="list__header">{{$index+1}}</li>
    <li class="list__item">{{result.name}}</li>
    <li class="list__item">{{result.address}}</li>
    <li class="list__item">{{result.phone_number}}</li>
</ul><br><br>

The above <br> is not renderd

like image 762
Blessan Kurien Avatar asked Feb 09 '23 13:02

Blessan Kurien


1 Answers

Use ng-repeat-start and ng-repeat-end:

    <ul class="list" ng-repeat-start="result in results">
                   <li class="list__header">{{$index+1}}</li>
                   <li class="list__item">{{result.name}}</li>
                   <li class="list__item">{{result.address}}</li>
                    <li class="list__item">{{result.phone_number}}</li>
    </ul><br><br ng-repeat-end />

Documentation: https://docs.angularjs.org/api/ng/directive/ngRepeat#special-repeat-start-and-end-points

like image 156
Meligy Avatar answered Feb 11 '23 13:02

Meligy