Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exporting from controller #35

Closed
davorpeic opened this issue Jun 16, 2014 · 7 comments
Closed

Exporting from controller #35

davorpeic opened this issue Jun 16, 2014 · 7 comments

Comments

@davorpeic
Copy link

Hi David,

awesome directive, but I'm wondering if I can get to work it without the button, but from controller where I would trigger the creation of the csv and use the result for something else besides download?

thank you

@asafdav
Copy link
Owner

asafdav commented Jun 16, 2014

Hi,
Yes you can do that, just use the CSV service and do whatever you want with
it.
You can look at the code, it's pretty straight forward. let me know if
something is missing there.

Good luck!

On Mon, Jun 16, 2014 at 11:55 PM, davorpeic notifications@github.com
wrote:

Hi David,

awesome directive, but I'm wondering if I can get to work it without the
button, but from controller where I would trigger the creation of the csv
and use the result for something else besides download?

thank you


Reply to this email directly or view it on GitHub
#35.

@davorpeic
Copy link
Author

Hi David,
awesome, I will paste how I used it, if someone else searches for the same solution

//inject CSV service in your controller
$scope.getArray = [{a: 1, b:2}, {a:3, b:4}];
$scope.options = {};
$scope.options.header = ['Field A', 'Field B'];

$scope.send_email = function() {
        CSV.stringify($scope.getArray, $scope.options).then(function(result){
            console.log(result);
        });
}

Thank you

@asafdav
Copy link
Owner

asafdav commented Jun 17, 2014

Hi!
Would you mind creating a wiki page that describes it ?
That way you will get credit and it would spread easily.

Thanks!

@asafdav asafdav closed this as completed Jun 17, 2014
@davorpeic
Copy link
Author

Of course :)

thanks

@asafdav
Copy link
Owner

asafdav commented Jun 18, 2014

Hi @davorpeic, thanks for the amazing work on the wiki!

Do you want to pull request a change to the README file so people will find your awesome wiki easily ?

@davorpeic
Copy link
Author

Hehe, sure :)
I will probably do that on the weekend.
I think it could all the info about the usage be in the wiki?

@asafdav
Copy link
Owner

asafdav commented Jun 19, 2014

Sounds good, Thanks a lot!

On Wed, Jun 18, 2014 at 2:33 PM, davorpeic notifications@github.com wrote:

Hehe, sure :)
I will probably do that on the weekend.
I think it could all the info about the usage be in the wiki?


Reply to this email directly or view it on GitHub
#35 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants