I am looking to implement a function from an external library that will be executed on each item as it is created in AngularJS. How can I achieve this? Here is the code snippet of my application.
var app = angular.module('app', []);
app.controller('MainCtrl', function($scope) {
$scope.blocks = [
{name: 'item #1'},
{name: 'item #2'}
];
});
<script src="https://code.angularjs.org/1.4.0-rc.2/angular.js"></script>
<script>
// This function is part of an external library
// I want to apply it to each block in ng-repeat
// It manipulates the DOM
function setupBlock(elm, name) {
elm.innerHTML = name + ' [ready]';
}
</script>
<body ng-controller="MainCtrl" ng-app="app">
<div ng-repeat="block in blocks">{{block.name}}</div>
</body>