// create the controller and inject Angular's $scope scotchApp.controller('mainWFController', // create a message to display in our view function($scope,$window ,$location ,$templateCache,mainPostFactory,commonService) { //alert("mainController"); init(); function init() { $scope.policyNo = ''; $scope.documentType = ''; } $scope.doCallProcess = function() { // alert(""); // alert($scope.policyNo); try{ var actLoadData = $.ajax(doGetPath('/callProcessWFMT.json'), { ajax: true, dataType: 'json', type: "POST", data:{ policyNoParam : $scope.policyNo, documentTypeParam : $scope.documentType } }).error( function (data) { alert("Session Time Out!!!"); //$location.path("/"); $scope.$apply(); }); actLoadData.success( function (data) { $window.open(data[1]); // $scope.$apply(); } ); }catch(e){ $scope.$apply(); } }; });