android - How to create a dynamic tag by using angularJS? -
i trying create html element using angularjs. want because want download file client available on server. saw easy way using html element href attribute. here piece of code :
$http({ url: '/process', method: 'post', headers: { 'content-type': 'application/json' }, data: appdata.elements }).then(function sucesscallback(response) { //create link , emulate click on }, function errorcallback(response) { });
so send request server. then, builds android project in purpose of generating apk. want download apk server clicking on element.
create dynamic <a>
tag,
$http({ url: '/process', method: 'post', headers: { 'content-type': 'application/json' }, data: appdata.elements }).then(function sucesscallback(response) { //create link , emulate click on var anchor = angular.element('<a/>'); angular.element(document.body).append(anchor); //hide css anchor.css({display: 'none'}); var body = $document.find('body').eq(0); body.append(anchor); anchor.attr({ href: data.content.filename, target: '_blank', download: 'filename.doc' })[0].click(); anchor.remove(); }, function errorcallback(response) { });
Comments
Post a Comment