arusahni / ngtweet

Easily embed Twitter widgets into your Angular application! No more having to kludge together a Twitter script loader, or manage embed state on route/visibility change.
http://arusahni.github.io/ngtweet/
MIT License
34 stars 22 forks source link

twttr.ready isn't always firing #33

Closed sujameslin closed 7 years ago

sujameslin commented 7 years ago

Hey @arusahni Its great work. Somehow I experienced that twttr.ready is not firing when twitter widget js is already loaded before. Because your code depends on twttr.ready, so if it isn't firing, whole this plugin stops working. https://github.com/arusahni/ngtweet/blob/develop/src/twitterWidget.service.js#L37 So i think you need to check if its loaded already by $window.twttr.init == true first and if it isn't, add listener to twttr.ready. i can submit PR if wanted

arusahni commented 7 years ago

Hi @sujameslin - thanks for the bug report! That's the downside of being a third-party library - Twitter doesn't communicate these changes. If you could file a PR, that'd be much appreciated. Thanks again!

GwilymNewton commented 7 years ago

@arusahni

I think I might be hitting this bug as well, I am seeing a TypeError: Cannot read property 'ready' of undefined at Object.loadScript [as initialize] (http://localhost:8080/bower_components/ngtweet/dist/ngtweet.js:273:22)

When I try and add ngtweet to my project.

@sujameslin would your pull be the fix to this ?

arusahni commented 7 years ago

Thanks for the submission, @sujameslin! I merged it in and cut a release. v0.6.2 should do the trick.

@GwilymNewton if v0.6.2 doesn't work for you, can you open a separate issue?