简体   繁体   English

未定义的参考误差函数未定义

[英]uncaught reference error function is not defined

I'm trying to make a quiz application implementing an increase if the right answer is clicked. 如果单击正确的答案,我将试图使测验应用程序实现增加。 I already know which answer is the right answer, but I want to make it so if you click the radio button it will increase the right answer counter. 我已经知道哪个答案是正确的答案,但是我想这样做,因此,如果单击单选按钮,它将增加正确的答案计数器。 I'm trying to use a method called correctTest to implement, but it is saying that I'm not defining it. 我正在尝试使用一种称为CorrectTest的方法来实现,但是这是在说我没有定义它。 Any ideas? 有任何想法吗?

$scope.correctTest = function($index) {
    if(document.getElementById("option+$index").checked){
        $http.put('quizQuestions', {
            _id: _id,
            isRight: 1
        })
    }
};

and the call to it is in a button. 它的调用在一个按钮中。

<input type="radio" name="option1+{{question._id}}" id="option1" value="option1" onclick="correctTest($index)">

are you sure you are in the correct controller and app? 您确定使用正确的控制器和应用程序吗?

if yes.. use ng-click 如果是的话..使用ng-click

<input type="radio" id="option1" value="option1" ng-click="correctTest($index)"/>correct test

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM