I am trying to render html into my view and i want to insert a function call inside this html but not getting any idea how i can do this. Here is my javascript:
angular.forEach($scope.patients, function (patient) {
tableRow = tableRow + [
'<div data-ng-click="popup("+patient+")">',
'<div class="name-container">+patient.name+</div>',
'</div>'].join('');
});
$scope.renderHTML =$sce.trustAsHtml(tableRow);
$scope.popup = function(patient) {
...
};
HTML:
<div data-ng-bind-html="renderHTML">
</div>
Is it possible to add patient object in popup() function using this way ?