fixed #834

parent 1e1e63f3
...@@ -73,9 +73,9 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr ...@@ -73,9 +73,9 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
});*/ });*/
// Add method selected to the student // Add method selected to the student
$scope.add_method = function(){ $scope.add_method = function(){
// Create a new method // Create a new method
if($scope.method_selected.id == 0){ if($scope.method_selected == 0){
$http $http
.post(config.backend+'/method/new', { .post(config.backend+'/method/new', {
...@@ -96,7 +96,7 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr ...@@ -96,7 +96,7 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
// Add method from templates // Add method from templates
$http $http
.post(config.backend+'/method', { .post(config.backend+'/method', {
'id_mmethod': $scope.method_selected.id, 'id_mmethod': $scope.method_selected,
'id_stu': $scope.studentData.id 'id_stu': $scope.studentData.id
}) })
.success(function(data, status, headers, config) { .success(function(data, status, headers, config) {
...@@ -106,7 +106,7 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr ...@@ -106,7 +106,7 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
}) })
.error(function(data, status, headers, config) { .error(function(data, status, headers, config) {
console.log("Error from API: " + data.error); console.log("Error from API: " + data.error);
console.log($scope.method_selected.id + " " + $scope.studentData.id); console.log($scope.method_selected + " " + $scope.studentData.id);
}); });
} }
}; };
......
...@@ -5,18 +5,18 @@ ...@@ -5,18 +5,18 @@
<!-- Select to add new method --> <!-- Select to add new method -->
<div class="form-group"> <div class="form-group">
<select class="form-control" name="method_select" id="method_select" ng-model="method_selected"> <select class="form-control" name="method_select" id="method_select" ng-model="method_selected">
<option ng-repeat="ma in methods_available track by $index" <option value="" translate>select_method</option>
value="{{ $index }}" <option ng-repeat="ma in methods_available track by $index"
label="{{ ma.name }}" ng-value="ma.id"
ng-if="ma.lang == user.lang"> label="{{ ma.name }}"
{{ ma.name }} ng-if="ma.lang == user.lang">
</option> {{ ma.name }}
</option>
<option value="" translate>select_method</option> <option value="0" translate>new_method</option>
</select> </select>
<!-- Botón añadir método --> <!-- Botón añadir método -->
<button ng-click="add_method()" class="btn btn-success btn-sm" popover="{{ 'add' | translate}}" popover-trigger="mouseenter" ng-disabled="method_selected.id == undefined"> <button ng-click="add_method()" class="btn btn-success btn-sm" popover="{{ 'add' | translate}}" popover-trigger="mouseenter" ng-disabled="method_selected == undefined">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
</button> </button>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment