javascript - AngularJS Downloadify bind data -


i try download word document receive base64 string web services.

on html page, ask user enter data populate word , when user click on button download word document.

button --> send web service --> create word document --> send base64 --> download base64 word document

i using downloadify make possible in ie9

the probleme downloadify ask filename , data on page load. information after user enter data on same page.

downloadify.create('downloadify', {     filename: filename,     data: data,     oncomplete: function () {         alert('your file has been saved!');     },     oncancel: function () {         alert('you have cancelled saving of file.');     },     onerror: function () {         alert('you must put in file contents or there nothing save!');     },     transparent: false,     swf: 'js/lib/downloadify/media/downloadify.swf',     downloadimage: 'js/lib/downloadify/images/download.png',     width: 100,     height: 30,     transparent: true,     append: false }); 

is there way bind filename , data ? or should add page data , ask "save on disk" ?

you can use iife, e.g.

filename: (function(){return $('#file-name-input').val();}())

i'm assuming downloadify lookup @ time of file save, though requires declared in advance.

otherwise, don't run downloadify.create(), generates download button, until necessary text boxes have been filled in , confirmed.

btw, in downloadify docs, mention you're allowed make data property point function. example be

data: function() { return "data comprises file contents"; }


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -