I have the following directive
feedBackModule.directive("responseCollection", ['deviceDetector', function (deviceDetector) {
return {
restrict: "E",
templateUrl: 'js/modules/Feedback/directives/feedbackResponse/collection.html',
scope: {
collections: '=',
completeCallback: '&'
},
link: function (scope, element, attr) {
scope.endCollection = function () {
scope.completeCallback(scope.collections);
}
}
};
}]);
This directive (as you can see) takes a function which is placed in the following controller:
feedBackModule.controller('FeedbackResponseController', ['$state', 'Query', 'feedbackSkillService', 'feedbackFactory', 'feedbackResponseService', function ($state, Query, SkillFactory, feedbackFactory, feedbackResponseService) {
var num_users = null;
var user_index = 0;
this.activeUser = null;
this.final = false;
this.feedback = feedbackResponseService.getFeedback();
this.completeUser = function (collections) {
this.activeUser.start = false;
if(user_index < (num_users-1)){
user_index++;
this.activeUser = this.feedback.feedback_has_target_users[user_index];
}
else
{
this.final = true;
}
}
}]);
Html:
<response-collection complete-callback="frCTRL.completeUser()" collections="frCTRL.feedback.feedback_collections" ng-if="frCTRL.activeUser.start && !frCTRL.final"></response-collection>
The function works and is correctly called however the variable i parse with it is always undefined
So my question is how can i pass a variable / object to a function like this?