ngRepeat (directive in module ng )

Description

The ngRepeat directive instantiates a template once per item from a collection. Each template instance gets its own scope, where the given loop variable is set to the current collection item, and $index is set to the item index or key.

Special properties are exposed on the local scope of each template instance, including:

Usage

as attribute
<ANY ng-repeat="{repeat_expression}">
   ...
</ANY>
as class
<ANY class="ng-repeat: {repeat_expression};">
   ...
</ANY>

Directive info

  • This directive creates new scope.
  • This directive executes at priority level 1000.

Parameters

Example

This example initializes the scope to a list of names and then uses ngRepeat to display every person:

Source





Demo