Angular Js: ng-repeat

As the name suggests, the directive ng-repeat is used to iterate over arrays or objects. Its syntax looks like the “for each” syntax of various languages programming.

The code above iterates over an array and each item has its property printed.

The array is defined in the scope, however the variable item is created by Angular and within the ng-repeat scope, you can access its properties.

Example

We will create an array of books in the controller and use the ng-repeat directive to show the books in a simple list of the html page.

Result:

index.html
Like what you read? Give pldias a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.