I need to pass the value of $scope.correct into the checkAnswer function but it keeps coming up undefined. ng-click only seems to understand it's own scope. What am I doing wrong?
angular.module('Tutorials', ['functions']).controller('getAnswers', function ($scope, $element){
$scope.verbs = conjugate(conjugationsets[tutorial_number][questionnum]);
$scope.correct = $scope.verbs.conjugations[0].text;
$scope.randomizeAnswers = function () {
fisherYates($scope.verbs.conjugations);
}();
$scope.checkAnswer = function (answer, correct){
checkanswer($scope, answer, correct);
}
});
You can use $scope.$parent to access the parent scope.
$scope.checkAnswer = function (answer){
checkanswer($scope, answer, $scope.$parent.correct);
}
Note: I haven't gone through the complete problem to see whether there is an better way to solve the problem