var list = angular.module('list', []); // Define the `PhoneListController` controller on the `phonecatApp` module list.directive('ngConfirmClick', [ function(){ return { link: function (scope, element, attr) { var msg = attr.ngConfirmClick || "Are you sure?"; var clickAction = attr.confirmedClick; element.bind('click',function (event) { if ( window.confirm(msg) ) { scope.$eval(clickAction) } }); } }; }]) list.controller('ListController', function ListController($http, $scope,tipo) { console.log(tipo); $scope.list = [] ; $scope.getList = function(){ $http({ method: 'GET', url: '/list/' + tipo }).then(function successCallback(response) { // this callback will be called asynchronously // when the response is available console.log(response.data) $scope.list = response.data; }, function errorCallback(response) { // called asynchronously if an error occurs // or server returns response with an error status. }); } $scope.getList() ; /* $scope.drop=function(course_academicsesion_id){ $http({ method: 'GET', url: '/drop?course_academicsesion_id='+course_academicsesion_id // data: $.param({"codigo" : $scope.selectedProgram}) }).then(function successCallback(response) { // this callback will be called asynchronously // when the response is available if(response.data.response.error == false){ $scope.getAllCoursesInSesion() ; } alert(response.data.response.msg); }, function errorCallback(response) { // called asynchronously if an error occurs // or server returns response with an error status. }); } */ });