I am currently facing a challenge in rendering HTML in my view and integrating a function call within this HTML. I'm struggling to find a way to accomplish this task. Below is the snippet of my JavaScript code:
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) {
...
};
Snippet of HTML code:
<div data-ng-bind-html="renderHTML">
</div>
My question is: Can the patient object be passed to the popup() function using this approach?