Commit 6f48f3a680848ace15ab3560fa31f705206b7013
1 parent
da678ed382
Exists in
master
and in
1 other branch
unbreak class add
Showing 1 changed file with 3 additions and 6 deletions Side-by-side Diff
scripts/ClassAddController.js
View file @
6f48f3a
1 | 1 | angular.module('flashy.ClassAddController', ['ui.router', 'ngMaterial']). |
2 | - | |
3 | - controller('ClassAddController', ['$scope', '$state', '$http', function($scope, $state, $http) { | |
4 | - | |
5 | - | |
2 | + controller('ClassAddController', function($scope, $state, $http, UserService) { | |
6 | 3 | $scope.trySearch = function(searchText) { |
7 | 4 | return $http.get('/api/sections/search/', { |
8 | 5 | params: { |
... | ... | @@ -17,7 +14,7 @@ |
17 | 14 | $scope.submit = function() { |
18 | 15 | $http.post('/api/sections/' + $scope.selectedItem.id + '/enroll/'). |
19 | 16 | success(function(data) { |
20 | - $scope.sections.push($scope.selectedItem); | |
17 | + UserService.getUserData().sections.push($scope.selectedItem); | |
21 | 18 | $state.go('feed', {sectionId: $scope.selectedItem.id}); |
22 | 19 | }). |
23 | 20 | error(function(data, status, header, config) { |
... | ... | @@ -36,5 +33,5 @@ |
36 | 33 | }); |
37 | 34 | };*/ |
38 | 35 | |
39 | - }]); | |
36 | + }); |