JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-app="mapp">
<div ng-controller="ctrl">
<custom-element ng-repeat="val in values" info="values[$index]"></custom-element>
<br/>
<br/>Total: <span>{{total()}}</span>
</div>
</div>
JavaScript
angular.module('mapp', [])
.controller('ctrl', ['$scope', function ($scope) {
$scope.values = [1,2,3,4,5];
$scope.b = 0;
$scope.total = function()
{
var t = 0;
for(var i in $scope.values)
{
t += $scope.values[i];
}
return t;
};
}])
.directive('customElement', function () {
return {
restrict: 'E',
scope: {
data: '=info'
},
template: '<input type="number" ng-model="data">\
<span>{{data}}</span>'
}
});