{"action":"created","issue":{"url":"https://api.github.com/repos/angular-google-chart/angular-google-chart/issues/243","labels_url":"https://api.github.com/repos/angular-google-chart/angular-google-chart/issues/243/labels{/name}","comments_url":"https://api.github.com/repos/angular-google-chart/angular-google-chart/issues/243/comments","events_url":"https://api.github.com/repos/angular-google-chart/angular-google-chart/issues/243/events","html_url":"https://github.com/angular-google-chart/angular-google-chart/issues/243","id":120372594,"number":243,"title":"Ready callbacks are called multiple times","user":{"login":"rixlabs","id":233226,"avatar_url":"https://avatars.githubusercontent.com/u/233226?v=3","gravatar_id":"","url":"https://api.github.com/users/rixlabs","html_url":"https://github.com/rixlabs","followers_url":"https://api.github.com/users/rixlabs/followers","following_url":"https://api.github.com/users/rixlabs/following{/other_user}","gists_url":"https://api.github.com/users/rixlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/rixlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rixlabs/subscriptions","organizations_url":"https://api.github.com/users/rixlabs/orgs","repos_url":"https://api.github.com/users/rixlabs/repos","events_url":"https://api.github.com/users/rixlabs/events{/privacy}","received_events_url":"https://api.github.com/users/rixlabs/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-12-04T10:20:40Z","updated_at":"2015-12-04T20:02:30Z","closed_at":null,"body":"I know you hate me :smile: \r\n\r\nFound out that the callback in agcOnReady  is called 2 times.\r\n\r\nI also tried to create a directive similar to agcOnReady and I had the same problem, so is the internal callback that is called 2 times(abviously)\r\n\r\n```\r\n  link: function(scope, element, attrs, googleChartController){\r\n                callback.$inject=['chartWrapper'];\r\n                function callback(chartWrapper){\r\n                    scope.$apply(function (){\r\n                        scope.$eval(attrs.agcOnReady, {chartWrapper: chartWrapper});\r\n                    });\r\n                }\r\n                googleChartController.registerWrapperListener('ready', callback, this);\r\n            }\r\n```\r\nDebugging a little...\r\nthe registerWrapperListener is called by default in the _init and then for the agcOnReady.\r\n\r\nThe  $google.visualization.events.addListener is called 2 time with 2 different listener: _handleReady and callback(chartWrapper).\r\n\r\nSo is possible that the google library call the listener's handling_functions multiple times or is something with the ng-google-chart code?\r\n\r\np.s. the multi call is a problem for me cause I have to **append**  a node inside the DOM and I'm seeing it 2 times. As workarround I can check if that node exist but..."},"comment":{"url":"https://api.github.com/repos/angular-google-chart/angular-google-chart/issues/comments/162068008","html_url":"https://github.com/angular-google-chart/angular-google-chart/issues/243#issuecomment-162068008","issue_url":"https://api.github.com/repos/angular-google-chart/angular-google-chart/issues/243","id":162068008,"user":{"login":"Balrog30","id":4421371,"avatar_url":"https://avatars.githubusercontent.com/u/4421371?v=3","gravatar_id":"","url":"https://api.github.com/users/Balrog30","html_url":"https://github.com/Balrog30","followers_url":"https://api.github.com/users/Balrog30/followers","following_url":"https://api.github.com/users/Balrog30/following{/other_user}","gists_url":"https://api.github.com/users/Balrog30/gists{/gist_id}","starred_url":"https://api.github.com/users/Balrog30/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Balrog30/subscriptions","organizations_url":"https://api.github.com/users/Balrog30/orgs","repos_url":"https://api.github.com/users/Balrog30/repos","events_url":"https://api.github.com/users/Balrog30/events{/privacy}","received_events_url":"https://api.github.com/users/Balrog30/received_events","type":"User","site_admin":false},"created_at":"2015-12-04T20:02:30Z","updated_at":"2015-12-04T20:02:30Z","body":"You stumbled across my least favourite feature of google charts: image uri. This is one of the features that I sort of looked at but not really when planning to have chart directives with different behaviour. The best way to handle this feature would be to have a chart directive that, instead of drawing, gets the imageUri and puts it in the source tag for an image. If I remember right about how I planned out the controller/service separation for the main directive, I think it might be possible. On a side note: how do you feel about TypeScript? I've been using it lately and creating method-compatible controllers for behaviour directives to use is a perfect use case for interfaces."}}