Skip to content

Commit a31fee0

Browse files
committed
solutionsCtrl now works
1 parent 24c1c9a commit a31fee0

4 files changed

Lines changed: 16 additions & 2 deletions

File tree

controllers/kataCtrl.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ module.exports = {
6060
},
6161

6262
getKataSolutions: (req, res, next) => {
63+
console.log('solutions ran');
6364
db.read.kata_solutions([req.params.kataId], (err, solutions) => {
6465
if (err) {
6566
console.log(err);

src/components/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ $stateProvider
3737
.state('menu.solutions',{
3838
url: 'solutions',
3939
templateUrl:'./components/solutions/solutions.html',
40-
// controller: 'solutionsCtrl'
40+
controller: 'solutionsCtrl'
4141
})
4242
.state('menu.training',{
4343
url: 'training',
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<div ng-init="init()"></div>

src/components/solutions/solutionsCtrl.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@
33

44
angular.module('app').controller('solutionsCtrl', function($scope, $state, mainService) {
55

6-
// get all solutions for one kata (by kataid) using the kataSolutions function on service.
6+
// get all solutions for one kata (by kataid) using the getKataSolutions function on service.
7+
$scope.getKataSolutions = (kataid) => {
8+
mainService.getKataSolutions(kataid).then(response => {
9+
$scope.kataSolutions = response.data;
10+
console.log($scope.kataSolutions)
11+
})
12+
}
13+
14+
$scope.init = () => {
15+
$scope.getKataSolutions(1 /* replace 1 with kataid when set up */);
16+
}
17+
18+
719

820
});

0 commit comments

Comments
 (0)