Skip to content

Commit 608c49f

Browse files
author
K.C. Hunter
committed
Adding ng-repeat tutorial.
1 parent 44119f5 commit 608c49f

3 files changed

Lines changed: 20 additions & 5 deletions

File tree

src/angularjstutorial.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ app.service("ravensService", function ($http, $q)
2020
var promise = ravensService.getPlayers();
2121
promise.then(function (data)
2222
{
23-
$scope.team = data;
24-
console.log($scope.team);
23+
$scope.players = data.data;
24+
console.log($scope.players);
2525
});
2626
})

src/index.html

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,22 @@
1616
<h1>Baltimore Ravens</h1>
1717

1818
<div data-ng-controller="ravensCtrl">
19-
19+
<table class="table table-striped">
20+
<thead>
21+
<tr>
22+
<th>Player</th>
23+
<th>Position</th>
24+
<th>Number</th>
25+
</tr>
26+
</thead>
27+
<tbody>
28+
<tr data-ng-repeat="player in players">
29+
<td>{{player.name}}</td>
30+
<td>{{player.position}}</td>
31+
<td>{{player.number}}</td>
32+
</tr>
33+
</tbody>
34+
</table>
2035
</div>
2136
</div>
2237

src/resources/js/ravensService.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ app.service("ravensService", function ($http, $q)
2020
var promise = ravensService.getPlayers();
2121
promise.then(function (data)
2222
{
23-
$scope.team = data;
24-
console.log($scope.team);
23+
$scope.players = data.data;
24+
console.log($scope.players);
2525
});
2626
})

0 commit comments

Comments
 (0)