Skip to content
Related Articles

Related Articles

Improve Article

How to fetch the details using ng-repeat in AngularJS?

  • Last Updated : 08 May, 2020
Geek Week

AngularJS consists of various types of pre-defined Directives. Most of the directives start with ng where ng is equivalent to Angular.

The ng-repeat directive is used to iterate over an object for its properties. A template is instantiated once an item from a collection. Every template has its own scope where the loop variable is set to the current collection item and $index is set to a key or the index of the item.

<element ng-repeat="(key, value) in Obj"></element>

where key and value can be used as a user-defined identifier in an expression.
Example:- This example shows the usage of the ng-repeat directive.

<!DOCTYPE html>
<script src=
<body ng-app="myTable">
<h2 style = "color:green">GeeksForGeeks</h2>
<table ng-controller="control" border="2">
<tr ng-repeat="x in records">
var app = angular.module("myTable", []);
app.controller("control", function($scope) {
  $scope.records = [
      "Country" : "India",
      "Capital" : "Delhi"
      "Country" : "America ",
      "Capital" : "Washington, D.C. "
      "Country" : "Germany",
      "Capital" : "Berlin"
      "Country" : "Japan",
      "Capital" : "Tokyo"


    My Personal Notes arrow_drop_up
Recommended Articles
Page :