JSFiddle - React, Tailwind, and code Playground
HTML
<body ng-app="myapp">
<!-- I'd like print the age (in the last <p>) of the name I'm clicking on -->
<div ng-controller="MyController" >
<ul>
<li ng-repeat="friend in myData.friends"
ng-click="myData.doClick(friend)">{{friend.name}}</li>
</ul>
<p>Age :</p>
<p>{{ currentAge }}</p>
</div>
<script>
angular.module("myapp", [])
.controller("MyController", function($scope) {
$scope.myData = {};
$scope.myData.friends = [{ name: "Al",age:26}, { name: "Mike",age:21}, { name: "Brian",age:46} ];
$scope.myData.doClick = function(friend) {
$scope.currentAge = friend.age;
}
} );
</script>
</body>