fixed #834

parent 1e1e63f3
......@@ -73,9 +73,9 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
});*/
// Add method selected to the student
$scope.add_method = function(){
$scope.add_method = function(){
// Create a new method
if($scope.method_selected.id == 0){
if($scope.method_selected == 0){
$http
.post(config.backend+'/method/new', {
......@@ -96,7 +96,7 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
// Add method from templates
$http
.post(config.backend+'/method', {
'id_mmethod': $scope.method_selected.id,
'id_mmethod': $scope.method_selected,
'id_stu': $scope.studentData.id
})
.success(function(data, status, headers, config) {
......@@ -106,7 +106,7 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
})
.error(function(data, status, headers, config) {
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 @@
<!-- Select to add new method -->
<div class="form-group">
<select class="form-control" name="method_select" id="method_select" ng-model="method_selected">
<option ng-repeat="ma in methods_available track by $index"
value="{{ $index }}"
label="{{ ma.name }}"
ng-if="ma.lang == user.lang">
{{ ma.name }}
</option>
<option value="" translate>select_method</option>
<option value="" translate>select_method</option>
<option ng-repeat="ma in methods_available track by $index"
ng-value="ma.id"
label="{{ ma.name }}"
ng-if="ma.lang == user.lang">
{{ ma.name }}
</option>
<option value="0" translate>new_method</option>
</select>
<!-- 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>
</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