'How to get download file from Laravel 5.1 with AngularJS and ui-router
I have this code in laravel for export excel:
public function export_excel(Request $request){
$user = user::all();
Excel::create('user', function($excel) use($user) {
$excel->sheet('Sheet 1', function($sheet) use($user) {
$sheet->fromArray($user);
});
})->download('xls');
}
and my route is:
Route::get('user/export/excel','UserController@export_excel');
and my html is:
<a><i class="fa fa-file-excel-o"></i> Export to Excel</a>
I want to send request from REST API with Restangular and after that get download file.
Solution 1:[1]
You can simple use the href attribute
<a href="user/export/excel" target="_BLANK">
<i class="fa fa-file-excel-o"></i> Export to Excel
</a>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | sam1188 |
