i have a directive which renders a long list. The Rendering works pretty fine and fast, now i would like to call a function on the Controller with Parameters. How can i achieve this?
Here is my directive:
.directive("slheats", function () {
return {
restrict: "A",
scope: {
slheats: "=",
},
link: function (scope, element, attrs) {
scope.$watch("slheats", function (data) {
angular.forEach(data, function (heat, h) {
var body = "";
var first = true;
var ct = 1;
body += "<div class='row heat'>" + heat.Heat + "</div>";
angular.forEach(heat.Entries, function (entry, e) {
var line = "";
ct++;
line += "<div class='name'><button ng-click='showdetails()'>" + entry.Name + "</button></div>";
body += line;
});
$(element).append(body);
});
});
}
}
})
.controller('startlistcontroller',['$scope', 'apiservice', 'objectservice', function ($scope, apiservice, objectservice) {
$scope.startlists = [];
$scope.selected = null;
$scope.showdetails = function (x) {
alert(x);
};
How can i call the showdetails function on my Controller?
Thanks Manuel!