角度进度条控制器 [英] angular progress-bar controller

查看:76
本文介绍了角度进度条控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个测验,需要在30秒内回答每一秒,所以我想创建一个进度条以向用户显示.30秒结束后,需要弹出警报,然后出现下一个问题.

I'm creating a quiz, every second needs to be answered in 30 seconds so I want to create a progressbar to show this to the user. When the 30 seconds are over, an alert needs te be popped up en the next question needs to appear.

有人知道如何开始吗?还是任何好的教程?我没有发现任何有趣的东西.

Does someone have any idea how to start with this? Or any good tutorial? I didn't find anything interesting.

我的控制器代码如下:

lycheeControllers.controller('quizCtrl', ['$scope', '$http', function ($scope, $http) {
    $http.get('json/questions.json').success(function (data) {
        //all questions
        $scope.questions = data;

        //filter for getting answers / question
        $scope.ids = function (question) {
            return question.id == number;
        }

        $scope.buttonText = "Next question";

        $scope.next = function () {
            if (!(number == (data.length))) {
                if (number + 1 == (data.length)) {
                    $scope.buttonText = "Get results";
                }
                number++;
                if (correct == true) {
                    points++;
                }
                //alert(points);
            } else {
                alert("Quiz finished: your total score is: " + points);
            }
        }

        $scope.checked = function (answer) {
            //alert(answer.answer);

            if (answer.correct == "yes") {
                correct = true;
            } else {
                correct = false;
            }

            //alert(correct);
        }
    });
}]);

推荐答案

我对此很感兴趣,并破解了一个可以用作起点的解决方案.它已经很完整了,所以看看吧,并从中得到启发.

I was really interested in this and hacked a solution, that you could use as a startingpoint. It is already quite complete, so just have a look and get inspired.

http://jsfiddle.net/rGWUR/7/

merry christmas :)

这篇关于角度进度条控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆