Angular save file as csv result in Failed- network error Only on Chrome


I'm using the following code to save file as csv.

$scope.saveCSVFile = function (result)
    var a         = document.createElement('a');
    a.href = 'data:application/csv;charset=utf-8,' + encodeURIComponent(;      = '_blank';    =  $scope.getFileNameFromHttpResponse(result);
    $scope.isReportInProgress = false;

The file is working on most of the cases but for some reason when the file is larger than 10MB i get "Failed - Network Error".

It happens only on chrome.

I tried to search the web for this issue and couldn't find anything relevant.

Can you think of an idea why does it happens? or maybe use a different save file method that will work on chrome/firefox/IE instead of my function?


I was finally used this one, hope it can help the next one encounter this issue:

 var blob = new Blob([], {type: 'text/csv'});
            var filename =  $scope.getFileNameFromHttpResponse(result);
            if(window.navigator.msSaveOrOpenBlob) {
                window.navigator.msSaveBlob(blob, filename);
                var elem = window.document.createElement('a');
                elem.href = window.URL.createObjectURL(blob);
       = filename;

Easiest way is to create validation in separate column.

enter image description here

<!DOCTYPE html>

<html xmlns="">
<head runat="server">
    <link rel="stylesheet" type="text/css" href="">
    <style type="text/css">
        .required {
            color: #e31937;
            font-family: Verdana;
            margin: 0 5px;

        .field-validation-error {
            color: #e31937;
            font-weight: bold;
    <form id="form1" runat="server">
        <br />
        <div class="container form-horizontal">
            <div class="form-group">
                <asp:Label runat="server"
                    CssClass="col-xs-12 col-sm-4 control-label">
                    <span class="required">*</span>
                <div class="col-xs-12 col-sm-4 ">
                    <asp:TextBox ID="txtBox" runat="server"
                        CssClass="form-control" />
                <div class="col-xs-12 col-sm-4 form-control-static">
                    <asp:RequiredFieldValidator ID="rfvLine1"
                        ControlToValidate="txtBox" runat="server"
                        Text="Line 1 is required." />
            <div class="form-group">
                <div class="col-xs-12 col-sm-offset-4 col-sm-4 ">
                    <asp:Button runat="server" ID="SubmitButton"
                        Text="Submit" CssClass="btn btn-primary" />
By : Win

This video can help you solving your question :)
By: admin