No Description

evaluacion.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. eval.directive('ngConfirmClick', [
  2. function(){
  3. return {
  4. link: function (scope, element, attr) {
  5. var msg = attr.ngConfirmClick || "Are you sure?";
  6. var clickAction = attr.confirmedClick;
  7. element.bind('click',function (event) {
  8. if ( window.confirm(msg) ) {
  9. scope.$eval(clickAction)
  10. }
  11. });
  12. }
  13. };
  14. }]);
  15. eval.controller('evalController', function evalController($http, $scope){
  16. $scope.evaluaciones = evaluaciones
  17. $scope.operacion = "Añadir" ;
  18. var teacherId = document.getElementById('maestroId').value;
  19. var ofertaId = document.getElementById('ofertaId').value;
  20. $scope.submitForm = function() {
  21. path ="/Maestro/"+teacherId+"/" +ofertaId;
  22. if ($scope.operacion =="Actualizar"){
  23. path += "/editar"
  24. }
  25. else{
  26. path += "/addNota"
  27. }
  28. $http.post(path, $scope.eval);
  29. }
  30. $scope.edit = function(key){
  31. $scope.eval = evaluaciones[key];
  32. $scope.operacion ='Actualizar';
  33. }
  34. $scope.anadir = function (){
  35. $scope.eval = {};
  36. $scope.operacion = 'Añadir';
  37. }
  38. });