fixate / angular-social-links

Flexible and easy social sharing directives for Twitter, Google plus and Facebook
http://fixate.github.io/angular-social-links/demo/
44 stars 12 forks source link

live binding does not work. .. #1

Closed mrunwal closed 9 years ago

mrunwal commented 9 years ago

I am trying to use functtion like

<a social-pinterest media="{{medImage}}" description="This is an awesome art" 
                class="fa fa-pinterest-square social-pinterest1"></a>               

but its not converting whats present in variable.

larrybotha commented 9 years ago

Can you provide us with a plunker that fails like this?

mrunwal commented 9 years ago

here is http://plnkr.co/edit/9IahkgyAE1ru5bJyV1wP type anything on textbox if its image url then it has update media attribute for pinterest or twitter status message.

Reason for showing this as when data coming from ajax and then we try bind with media attribute or description things doesn't looks working.

let me know if you have some solution for it.

sdbondi commented 9 years ago

@mrunwal Thanks for the example - try v0.0.12 !

mrunwal commented 9 years ago

I have tried same code but it looks its still the same.

sdbondi commented 9 years ago

Updated code works in plunkr for "http://lorempixel.com/1200/630/" http://plnkr.co/edit/NlnvU8D2VeY40wB846p4

I'm guessing that you don't want to have the user click on the share button before your media url has been retrieved from ajax. The share buttons will update the url when clicked. We want to keep the directives clean and light-weight without unnecessary watches.

Perhaps you can consider hiding the share buttons until you are ready to share - we have done this on a project without issue.

mrunwal commented 9 years ago

Thank for efforts but my logic was different. eg. when angular load the products using ajax then product attribute variables updates after few mili-seconds and then once its loaded that product variable's image should be used for pinterest. but right now when Ajax gots response and when its time to see the url...media fields is gets blank...

Anyway...thanks for help

sdbondi commented 9 years ago

When clicking on the pinterest icon on your page the media image is working. The url on the link has a blank media string because of the variable being blank at the linking time of the directive. The correct url is opened in the window.

If you can provide a use-case for the href live binding and a pull request we'd be happy to merge if the code stays clean.

Closing this issue for now.

mrunwal commented 9 years ago

Thanks it work as per your words... live binding now working. though status url does not show but when popup appears its functional.

lommaj commented 9 years ago

Seems like this would be more effective if you got the URL when you do the click, instead of filling the href when the directive loads.

I am using this on a page template where the route changes and the share template is static in the sidebar and just keeps whatever the first URL was when the page loaded.

thequiet commented 9 years ago

Thanks for building this! Great clean code. I, too am looking to live bind my custom URL.

I second @lommaj and his views on the subject. I am working on a playlist application, and want to be able to share each song when the url changes. Right now it is just stuck on the song that first loads.