How to display length of filtered ng-repeat data

前端 未结 8 1339
花落未央
花落未央 2020-11-22 08:11

I have a data array which contains many objects (JSON format). The following can be assumed as the contents of this array:

var data = [
  {
    \"name\": \"         


        
8条回答
  •  心在旅途
    2020-11-22 08:38

    For Angular 1.3+ (credits to @Tom)

    Use an alias expression (Docs: Angular 1.3.0: ngRepeat, scroll down to the Arguments section):

    For Angular prior to 1.3

    Assign the results to a new variable (e.g. filtered) and access it:

    Display the number of results:

    Showing {{filtered.length}} Persons
    

    Fiddle a similar example. Credits go to Pawel Kozlowski

提交回复
热议问题