【问题标题】:uncaught reference error function is not defined未定义未捕获的参考错误函数
【发布时间】:2016-06-11 09:12:25
【问题描述】:

如果单击正确答案,我正在尝试制作一个测验应用程序来实现增加。我已经知道哪个答案是正确答案,但我想这样做,所以如果您单击单选按钮,它将增加正确答案计数器。我正在尝试使用一个名为 correctTest 的方法来实现,但它是说我没有定义它。有任何想法吗?

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

并且对它的调用是在一个按钮中。

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

【问题讨论】:

    标签: javascript jquery html angularjs mean


    【解决方案1】:

    您确定您使用的是正确的控制器和应用程序吗?

    如果是的话.. 使用ng-click

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

    【讨论】:

      猜你喜欢
      • 2017-08-31
      • 2016-10-03
      • 2020-08-31
      • 1970-01-01
      • 2016-06-03
      • 1970-01-01
      • 2017-01-02
      • 2014-10-03
      • 1970-01-01
      相关资源
      最近更新 更多