I have the following code:
$scope.someVar = function(parameter){
if ($scope.parameter[this.$index].toCheck == 'false') {
$scope.anotherVar= '.'
} else {
$scope.anotherVar = ', to check with you if it has worked.'
}
};
When I then call in HTML:
<a href="#" ng-repeat="test in tests" ng-click="template(emails)">Link</a>
I get the following error:
TypeError: Cannot read property '0' of undefined
at ChildScope.$scope.someVar (mainController.js:80)
What am I doing wrong?
Thank you in advance for your suggestions.
$scope.parametercomes from? do you want it to beparameterinstead? Because it's not an array, so you can't take an index (property) of it with[this.index]. Isthis.indexeven an number, or a string?