forked from CodewarsClone/Codewars
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsolutionsCtrl.js
More file actions
40 lines (29 loc) · 1.19 KB
/
Copy pathsolutionsCtrl.js
File metadata and controls
40 lines (29 loc) · 1.19 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
/************ SOLUTIONS CONTROLLER *********/
angular.module('app').controller('solutionsCtrl', function($scope, $state, mainService, $stateParams) {
$scope.kataid = $stateParams.kataid;
$scope.user = mainService.user;
// $scope.kataSolutions = [{ script:"function dog(x) { var jerk = 'hello' }"}];
$scope.getKataById = (kataid) => {
mainService.getKataById(kataid).then(response => {
console.log(response.data);
$scope.kataById = response.data;
$scope.getKataSolutions($scope.kataid);
console.log($scope.kataById);
})
}
var solutionsExist = false;
$scope.getKataSolutions = (kataid) => {
mainService.getKataSolutions(kataid).then(response => {
$scope.kataSolutions = response.data;
if ($scope.kataSolutions[0]) {
// solutionsPageCode.setValue("Here's where your code should be.");
} else {
// solutionsPageCode.setValue("It looks like you haven't submitted any solutions to this kata.");
}
console.log($scope.kataSolutions)
})
}
$scope.init = () => {
$scope.getKataById($scope.kataid);
}
});