asafdav / ng-csv

Simple directive that turns arrays and objects into downloadable CSV files
MIT License
573 stars 215 forks source link

How do make ng-csv wait for the data before download the file #117

Closed cicw closed 8 years ago

cicw commented 8 years ago

Hi, Can you help me a litle bit on this?

\ Code from view a href='return:void(0)' ng-csv='buildLab()' lazy-load='true' filename='lab.csv' >Lab (Lazy)/a

\ Js Code $scope.buildLab = function() { return exportService.getCustomers().then(function(data){ return data.data }) }

As I can see buildLab is downloading the file before the promise returns the data.

am I missing something obvious here? I´m using version 0.3.4

thank´s