Cant Load Excel File When Calling Laravel Controller from AngularJS

Hi i am sending some data to laravel controller from angularjs and based on this data I want to get data from sql table and download as excel file. But I cannot download the file

Angular code

    $scope.sendSetField = function (selected_list) {        
    var arr = [];
    angular.forEach(selected_list, function(value, key){
        arr.push(key);
    });
    //console.log(selected_list);
    $http.post("http://localhost/maxo_ats_v1.00/dashboard/jobsDownload",arr)
   .then(function(response) {                 
    });

      

Laravel Controller:

     public function downloadJobsList(Request $request)
 {
   // $jobs = CnfFormField::select('id', 'name', 'email', 'created_at')->get();

  $jobs = Input::all();
 // return view('jobs.columnSelect',compact['data']);
  $data = Jobs::select($jobs)->get();

    Excel::create('Job', function($excel) use ($data) {
        $excel->sheet('mySheet', function($sheet) use ($data)
        {
            $sheet->fromArray($data);
        });
     })->download('xlsx');
 }

      

Route

Route::post('dashboard/jobsDownload','JobsController@downloadJobsList');

      

+2


source to share





All Articles