Hi I am having trouble using a parameter in my template for a function that I have passed into a directive with isolate scope. The directive uses the template in which I am calling the function but for some reason my parameter "meetpunt" is undefined:
my template where meetpunt seems to be undefined when I debug the getCoordinaten function:
<tr ng-repeat="meetpunt in meetpunten">
<td>{{getCoordinaten(meetpunt)}}</td>
</tr>
my directive:
angular.module('zendantennesApp').directive('meetpuntTabel', function() {
return {
restrict: 'E',
templateUrl: 'views/components/meetpunt-tabel/meetpunt-tabel.html',
scope: {
single: '@',
meetpunten: '=',
getCoordinaten: '&'
},
link: function(scope, element, attrs) {
}
}
});
my controller:
'use strict';
angular.module('zendantennesApp')
.controller('MeetpuntTabelCtrl', function ($scope) {
$scope.getCoordinaten = function (meetpunt) {
return '(' + meetpunt.geometry.coordinates[0] + ', ' + meetpunt.geometry.coordinates[1] + ')';
};
});
this is how I am calling the directive:
<section ng-controller='MeetpuntTabelCtrl'><meetpunt-tabel meetpunten='meetpunten' get-coordinaten='getCoordinaten(meetpunt)' single='true'></meetpunt-tabel></section>
any help would be appreciated. kind regards
$parentbecause you are in ang-repeat?$parent.getCoordinaten(meetpunt)