LabExercController.js
3.36 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/// <reference path="../../content/data/json/le/LabExercise.js" />
AIA.controller("LabExercController", ["$scope", "$rootScope", "pages", "$log", '$http', 'DataService','$filter','$location',
function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location) {
$scope.LabExerciseName;
$scope.LabExerciseQuiz = null;
$scope.TotalNumberofQuiz = "0";
$scope.quiznumber = 1;
$scope.activityTitle = "";
$scope.Title = "";
$scope.$on('$viewContentLoaded', function (event) {
// code that will be executed ...
// every time this view is loaded
$scope.showme = false;
$rootScope.currentActiveModuleTitle = pages[8].name;
$scope.getLabExerciseModules();
$scope.scroll();
});
// $scope.showme = false;
$scope.IsVisible = function () {
// $scope.scroll();
}
$scope.scroll = function () {
// $window.scrollTo(0, 0);
$("html,body").scrollTop(0);
//alert("scroll");
}
// $rootScope.currentActiveModuleTitle = pages[8].Name;
//to get all lab exercise modules from json files
$scope.getLabExerciseModules = function () {
//debugger;
$scope.LabExerciseModules = null;
var commondataJsonPath = '~/../content/data/json/le/LabExercise.json';
DataService.getAnotherJson(commondataJsonPath).then(
function (result) {
//debugger;
//alert(JSON.stringify(result));
$scope.LabExerciseModules = result;
},
function (error) {
console.log(error.statusText)
}
)
}
$scope.getLabExerciseTitle = function (title) {
if(title!=null)
{
$scope.LabExerciseQuiz = title;
$scope.LabExerciseName = title.Topic;
$location.url("/lab-exercises-detail?topic=" + (title.Topic || ""));
}
}
$scope.GetQuizByTopic=function()
{
var keywords = $location.search();
$scope.LabExerciseName = keywords.topic;
$scope.LabExerciseModules = null;
var commondataJsonPath = '~/../content/data/json/le/LabExercise.json';
DataService.getAnotherJson(commondataJsonPath).then(
function (result) {
//debugger;
$.each(result.LabExercise, function (index, value) {
if (result.LabExercise[index].Topic == keywords.topic)
{
$scope.TotalNumberofQuiz = result.LabExercise[index].NumberofQuestions;
$.each(result.LabExercise[index].Questions, function (index1, value1) {
if (result.LabExercise[index].Questions[index1].Number == $scope.quiznumber)
{
$scope.LabExerciseModules = result.LabExercise[index].Questions[index1];
$scope.activityTitle = result.LabExercise[index].Questions[index1].activityTitle;
$scope.Title = result.LabExercise[index].Questions[index1].Title;
}
});
alert(JSON.stringify($scope.LabExerciseModules));
//$scope.quiznumber++;
}
});
},
function (error) {
console.log(error.statusText)
}
)
}
}]
);