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

Seems that some attributes are being ignored in 0.2.3 #53

Open
SimeonC opened this issue Sep 2, 2014 · 2 comments
Open

Seems that some attributes are being ignored in 0.2.3 #53

SimeonC opened this issue Sep 2, 2014 · 2 comments

Comments

@SimeonC
Copy link
Contributor

SimeonC commented Sep 2, 2014

Using these attributes: ng-csv="csv.generate()" quote-strings="true" lazy-load="true" csv-header="csv.header()" filename="timesheet.csv" it seems that the csv-header and filename attributes are being ignored.

I think the issues are here: L41 return $scope.filename || 'download.csv'; The scope isn't getting the value, as you aren't actually watching the value it's probably better to use $attrs.filename instead of $scope.filename and I think they dropped the '@' scope declaration at some point in angular 1.2 which is probably why it isn't working for me.

The other issue is here: L49 if (angular.isDefined($attrs.csvHeader)) options.header = $scope.$eval($scope.header);. I think you meant to do $scope.$parent.$eval($scope.header) as your scope option in the directive is creating a child scope.

I've found that optional attributes are generally better off not putting on the scope option of the directive and just checking for their existence via $attr.

Thanks for the module, apart from those it's worked great for me.

@asafdav
Copy link
Owner

asafdav commented Sep 10, 2014

Hi,
Sorry for my late response.
Thank you for your elaborated description here, would you be able to post a plunker that I can play with ?

Thanks again

@leafsicle
Copy link

I'm not going to lie I was having serious issues with getting my double quotes but seeing this issue helped me fix my bug. Thank you!

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

3 participants