There are two ways to do this in angularjs ..
1) Direct redirection to your service call.
<a href="some/path/to/the/file">clickme</a>
2) By submitting a hidden form.
$scope.saveAsPDF = function() { var form = document.createElement("form"); form.setAttribute("action", "some/path/to/the/file"); form.setAttribute("method", "get"); form.setAttribute("target", "_blank"); var hiddenEle1 = document.createElement("input"); hiddenEle1.setAttribute("type", "hidden"); hiddenEle1.setAttribute("name", "some"); hiddenEle1.setAttribute("value", value); form.append(hiddenEle1 ); form.submit(); }
use a hidden element when you need to send some element
<button ng-click="saveAsPDF()">Save As PDF</button>
Prathyusha Bandela Nov 10 '14 at 9:54 2014-11-10 09:54
source share