Skip to content

Instantly share code, notes, and snippets.

@Shawful
Created May 5, 2014 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shawful/11542993 to your computer and use it in GitHub Desktop.
Save Shawful/11542993 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script>
<meta name="description" content="JSON sourced ng-Repeat simple example" />
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body ng-app="app">
<div ng-controller="repCtrl">
<div ng-repeat="rep in reps"
<p>{{rep.name}}</p>
</div>
There are {{reps.length}} reps.
<p>The first rep is :<br>
{{reps[0]}}</p>
</div>
</body>
</html>
var app = angular.module('app',[]);
app.controller('repCtrl',['$scope', function($scope){
$scope.reps = [{
"name": "Michael",
"role": "Rep"
}, {
"name": "Ted",
"role": "Senator"
}, {
"name": "John",
"role": "Senator"
}];
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment