-
Notifications
You must be signed in to change notification settings - Fork 0
/
controller.js
51 lines (39 loc) · 1.31 KB
/
controller.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
app.controller('mainCtrl',
function mainCtrl($scope) {
$scope.currQ = 0;
$scope.qList = [
{ question: 'Test Question A', response : '' }
,{ question: 'Test Question B', response : '' }
,{ question: 'Test Question C', response : '' }
,{ question: 'Test Question D', response : '' }
,{ question: 'Test Question E', response : '' }
];
var selectResponse = function(respCode) {
$scope.qList[$scope.currQ].response = respCode;
};
$scope.setQuestion = function (newIndex) {
if(newIndex >= 0 || newIndex < $scope.qList.length) {
$scope.currQ = newIndex;
}
};
$scope.nextQuestion = function () {
if($scope.currQ < $scope.qList.length-1) {
$scope.currQ++;
}
};
$scope.prevQuestion = function () {
if($scope.currQ > 0) {
$scope.currQ--;
}
};
$scope.select1 = function () {
selectResponse('1');
};
$scope.select2 = function () {
selectResponse('2');
};
$scope.select3 = function () {
selectResponse('3');
};
}
);