Ingen beskrivning

list.js 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. var list = angular.module('list', []);
  2. // Define the `PhoneListController` controller on the `phonecatApp` module
  3. list.directive('ngConfirmClick', [
  4. function(){
  5. return {
  6. link: function (scope, element, attr) {
  7. var msg = attr.ngConfirmClick || "Are you sure?";
  8. var clickAction = attr.confirmedClick;
  9. element.bind('click',function (event) {
  10. if ( window.confirm(msg) ) {
  11. scope.$eval(clickAction)
  12. }
  13. });
  14. }
  15. };
  16. }])
  17. list.controller('ListController', function ListController($http, $scope,tipo) {
  18. console.log(tipo);
  19. $scope.list = [] ;
  20. $scope.getList = function(){
  21. $http({
  22. method: 'GET',
  23. url: '/list/' + tipo
  24. }).then(function successCallback(response) {
  25. // this callback will be called asynchronously
  26. // when the response is available
  27. console.log(response.data)
  28. $scope.list = response.data;
  29. }, function errorCallback(response) {
  30. // called asynchronously if an error occurs
  31. // or server returns response with an error status.
  32. });
  33. }
  34. $scope.getList() ;
  35. /*
  36. $scope.drop=function(course_academicsesion_id){
  37. $http({
  38. method: 'GET',
  39. url: '/drop?course_academicsesion_id='+course_academicsesion_id
  40. // data: $.param({"codigo" : $scope.selectedProgram})
  41. }).then(function successCallback(response) {
  42. // this callback will be called asynchronously
  43. // when the response is available
  44. if(response.data.response.error == false){
  45. $scope.getAllCoursesInSesion() ;
  46. }
  47. alert(response.data.response.msg);
  48. }, function errorCallback(response) {
  49. // called asynchronously if an error occurs
  50. // or server returns response with an error status.
  51. });
  52. }
  53. */
  54. });