I have a jQuery jTable, which is being initalized with angularjs $document.ready function. Here the column with ng-click event in it:
$document.ready(function () {
jQuery('#tblArticlesSearch').jtable({
paging: true
fields:{
ToCart: {
width: '1%',
display: function () {
return '<i class="fa fa-shopping-cart"
aria-hidden="true" ng-click="AddToDeliveryList();"></i>';
}
}
}
}
});
});
In controller, here is the function:
angular.module("deliveryListModule")
.controller("deliveryListController", ["$scope", "$http", "$document", function ($scope, $http, $document) {
$scope.AddToDeliveryList = function () {
alert("add");
}
And of course, controller and module are applied on document:
<div id="divMain" class="divMain" ng-app="deliveryListModule"
ng-controller="deliveryListController">
Problem is, that ng-click event is not firing when I click on the item. Nothing happens. Why is that?
EDIT:
With thanks to Tushar, I've used this line of code and it works fine now:
return $compile('<i class="fa fa-shopping-cart" aria-hidden="true" ng-click="AddToDeliveryList();"></i>')($scope);
Of course, I've also injected $compile.