I'm having trouble getting a click event to fire from some content that is loaded via ajax. Not seeing either console.log from the following code:
myApp.controller("MainController", function($scope, $http, $sce){
$scope.showModal = false;
$scope.openModal = function(name){
$scope.showModal = true;
$http({
method : 'GET',
url : '/template/fetch?name=' + name
}).success(function(modalHtml){
$scope.modalHtml = $sce.trustAsHtml(modalHtml);
$scope.closeModal = function(){
console.log("test 2");
};
});
};
$scope.closeModal = function(){
console.log("test 1");
};
});
And here is the html that is loaded via ajax:
<div class="modal">
<div class="modal-cover">
</div>
<div class="modal-container">
<div class="modal-close" ng-click="closeModal()"></div>
<div class="modal-content-container" ng-bind-html="modalContent">
</div>
</div>
</div>
Thanks!