'use strict'; /*** controller***/ app.controller('report_ans_bookletCtrl', ["$scope", "API_POINTS", "$http", "SweetAlert", "$state", 'md5', 'ipCookie', '$window', function ($scope, apiPoint, $http, SweetAlert, $state, md5, ipCookie, $window) { // DataTables configurable options $scope.filters = { "branch": "", "university": "", "batch": "", }; $scope.filters = function () { var filterlist = { method: 'POST', url: apiPoint.url + 'report_filters/', headers: { 'Content-Type': 'application/json' } }; $http(filterlist).then(function (response) { if (response.data) { $scope.batch = response.data.batch; $scope.branch = response.data.branch; $scope.university = response.data.university; //console.log($scope.branch); } else { } }); } $scope.onSubmit = function () { //alert($scope.batch.name); $scope.ans_book_data = ''; $scope.message = ''; var response_data = { method: 'POST', url: apiPoint.url + 'report_answer_booklet/', headers: { 'Content-Type': 'application/json' }, data: { branch: $scope.filters.branch, university: $scope.filters.university, batch: $scope.filters.batch } }; $http(response_data).then(function (response) { if (response.data.ans_bookletList == true) { $scope.ans_book_data = response.data.ans_book_data; } else { $scope.message = response.data.message; } }); } }]);