I have some elements on the page already generated from my server, I am trying to get angularjs to register a click event on that element, how can I do that?
My span elements are:
<span id="SpanIdHere" class="data-field"></span>
I have a jquery event handler for each clicked field as I do not know which other way I can hook onto the click event, as the server has generated this html for me.
$("#report-html-content .data-field").click(function () {
var id = $(this).attr("id");
openFieldWithData(id);
});
This is the code that I have in my angular controller that will open an modal-overlay.
function openFieldWithData(selection) {
console.debug(selection);
$scope.SelectedField.Name = selection
$("#template-detail").addClass("open");
};
What I am trying to do is show a modal-overlay when each field is clicked in the UI.
This code fully works except when the jquery click event is called, only when I close the modal, the name of the field appears in the html.
<div id="template-detail" class="overlay-report">
<div class="inner">
<div class="panel panel-default">
<div class="panel-heading">
<h6>
Template field
<button ng-click="closePanel()" data-id="btnCloseOverlay" type="button" class="close pull-right">×</button>
</h6>
</div>
<div class="panel-body">
{{SelectedField.Name}}
</div>
</div>
</div>
</div>