Hi Swapnika,

Creating and saving files is possible in most modern browsers. I have had 
good results with the following snippet on most browsers:

function downloadIt(text, filename, type) { 
   var link = document.createElement("a"); //set up anchor 
   type = type || "text/html"
   link.setAttribute("target","_blank"); 
   if(Blob !== undefined) { 
       var blob = new Blob([text], {type: type}); 
       link.setAttribute("href", URL.createObjectURL(blob)); 
    } else { 
       link.setAttribute("href","data:text/html," + encodeURIComponent(text)); 
    }
    link.setAttribute("download",filename); 
    document.body.appendChild(link); 
    link.click(); 
    document.body.removeChild(link); 
};


Has nothing to do with angualr whatsoever tough ;)


Regards

Sander


-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to