Following is my plnkr, which is working fine If I am not passing any parameter to my open1
method, but I need to pass an object in $scope.open1
method but it is throwing error.
Let me know what I am doing wrong.
Plnkr - http://plnkr.co/edit/dzYfy1qtmBD3ng804nXR?p=preview
Code where I am facing issue -
function imageHtml(data, type, full, meta) {
// Error here
var testData = {"key1": "val1", "key2": "val2"};
return '<img src="'+data+'" ng-click="open1('+testData+')" />';
}
I am alerting data via this method -
$scope.open1 = function(data) {
alert(data);
};
EDIT -
Data needs to be pass on image click.