I have a function defined in my controller that get's bound to an a element with ng-click, the li element in which the a element is nested also has an ng-repeat directive.
When I inspect the $scope of that controller through the angular chrome developer tools, I see that the function, in this case, $scope.goToApp is null.
I've done this a lot of other times in my other controllers, so to be sure that I didn't made any typos I've copy-pasted how I did it from another controller, but to no avail.
Controller:
(function () {
'use strict';
var controllers = angular.module('portal.controllers');
controllers.controller('applicationController',['$scope', 'ApplicationService', 'NavigationService','$rootScope', function ($scope, ApplicationService, NavigationService,$rootScope) {
$scope.goToApp = function(appId){
NavigationService.navigateToApp(appId, false);
};
$rootScope.ESS = ApplicationService.getApplications(Constants.id_ESS);
$rootScope.SVF = ApplicationService.getApplications(Constants.id_SVF);
$rootScope.MED = ApplicationService.getApplications(Constants.id_MED);
$rootScope.$watch('ESS', function(newValue){
$scope.ESS = newValue;
});
$rootScope.$watch('SVF', function(newValue){
$scope.SVF = newValue;
});
$rootScope.$watch('MED', function(newValue){
$scope.MED = newValue;
});
}]);
}());
HTML:
<li data-ng-repeat="tool in ESS | filter: {tool:true} | orderBy:'description'" class="col-lg-12">
<a class="toolLink" href="#" data-ng-click="goToApp({{tool.code}})">{{ tool.description }}</a>
</li>
Debugger:
goToApp: null
data-ng-click="goToApp(tool.code)"
– CodeHater Nov 29 at 9:47