<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
<script src="Scripts/jquery-2.1.4.js"></script>
<script src="Scripts/angular.js"></script>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope)
{
$scope.people = [
{
name: 'Mike',
age: 20
},
{
name: 'Peter',
age: 22
}];
})
app.directive('myElement', function()
{
return {
restrict: 'E',
scope:
{
person: '='
},
template: '<div>{{ person.name }}</div> <div>{{ person.age }}</div><p>{{temp}}</p>'
}
})
</script>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
<my-element ng-repeat="p in people" person='p'></my-element>
</body>
</html>This code snippet for using angularjs custom directive to access an ng-repeat item in a directive's scope.