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

ng-repeat is repeated n*n times #8

Closed
jimpoulakos-snippets opened this issue Aug 19, 2013 · 3 comments
Closed

ng-repeat is repeated n*n times #8

jimpoulakos-snippets opened this issue Aug 19, 2013 · 3 comments

Comments

@jimpoulakos-snippets
Copy link

I am using the Google Chart directive in a project. I have an issue wherein all ng-repeats are repeated a number of times equal to the number of rows being iterated across.

I have tried selectively removing all functionality from my script, and this problem only appears after I turn on the google charts directive.

What is happening is this: I have a chart that is attached to a controller. I have another controller that has data. I use a service to communicate the currently selected data from the user-editable controller into the chart-drawing controller. If I turn off the chart directive, my ng-repeats loop through each element correctly and everything is displayed appropriately.

When I turn on the chart directive, all my charts render initially correctly, then the chart is drawn, and then all of my ng-repeats are iterated over again. Only this time, they are iterated over multiple times. For instance,

$scope.dataset.rows = [ {label: 'Test 1', value: 1}, {label: 'Test 2', value: 2}, {label: 'Test 3', value: 3} ];

normally will display

Test 1 (1)
Test 2 (2)
Test 3 (3)

when I have the chart directive turned off. When I turn the directive back on, I get this:

Test 1 (1)
Test 1 (1)
Test 1 (1)
Test 2 (2)
Test 2 (2)
Test 2 (2)
Test 3 (3)
Test 3 (3)
Test 3 (3)

This is obviously not correct. I tried sticking some data into a plunkr, but it does not seem to understand or interpret standard angular correctly. (It only seems to work when setting functions and variables in the global scope, possibly due to the way it is interpreted on plunkr) As such I do not have any code that you can see this issue happen with.

Any suggestions on fixing this would be great, as I do not want to have to write a custom set of functionality to use either google charts or another chart library.

@jimpoulakos-snippets
Copy link
Author

I was taking out individual lines, and this line:
angular.bootstrap(document.body, ['myCustomApplicationModule']);

located in the googe.setOnLoadCallback() closure is causing the issue.

It seems to work fine without this line in place, but I may be missing some kind of functionality that I have not seen yet.

@bouil
Copy link
Contributor

bouil commented Aug 24, 2013

Sorry I didn't had time to look at your issue due to vacation.

I will have a closer look in a couple of days.

@bouil
Copy link
Contributor

bouil commented Aug 31, 2013

Please tell if with the 0.0.2 version you still have the issue

@bouil bouil closed this as completed Sep 13, 2013
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