Comments (8)
Which version of the library are you using?
If on >=2.0.0, make sure you call ShareButtonsModule
.forRoot() when importing the module.
import {ShareButtonsModule} from "ng2-sharebuttons";
@NgModule({
imports: [
ShareButtonsModule.forRoot()
]
})
from ngx-sharebuttons.
Yes that's resolved @tinesoft
Now getting another problem.
Uncaught Error: Can't resolve all parameters for ShareButton: (?, ?, ?).
My template is like this :
<share-button
[button]='fbButton'
[description]="description"
[tags]="tags">
</share-button>
And in component I am using:
fbButton;
tags = 'My fb share';
description = "This is a first sharing description";
ngOnInit() {
this.fbButton = new ShareButton(ShareProvider.FACEBOOK,
"<img src='../assets/piblic/img/fb-share.svg'>",
'facebook'
);
}
from ngx-sharebuttons.
Hi,
This might be a bug introduced in V2, as the single <share-button>
component is no longer exported in the ShareButtonsModule
(even if the related files are present in the NPM package)....
Until then, you can either :
- use the new
[shareButton]
directive to customize an existing button element - use the
<share-button
s>
component (note the "s" at the end)
For the 2nd solution:
my-component.html
<share-buttons
[facebook]="fbButton"
[description]="description"
[tags]="tags"
></share-buttons>
note: if you don't want a button to appear, you can hide it with this: [twitter]="false"
for e.g
and in the component
my-component.ts
fbButton = '<img src="../assets/piblic/img/fb-share.svg">';
tags = 'My fb share';
description = 'This is a first sharing description';
from ngx-sharebuttons.
Thanks a lot @tinesoft
That's working fine.
Now there are 2 problems while display button and sharing content.
Thanks in advance :)
from ngx-sharebuttons.
Which solution did you end up with? the [shareButton]
directive or the <share-buttons>
component ?
For the later, please note that it is:
fbButton = '<img src="../assets/piblic/img/fb-share.svg">';
and not:
fbButton = new ShareButton(ShareProvider.FACEBOOK,
"<img src='../assets/piblic/img/fb-share.svg'>",
'facebook');
For most buttons, the sharing window does not work on http://localhost (only on deployed URL)
You can set the [url]
to an existing URL to test and make sure everything works as expected
from ngx-sharebuttons.
OK @tinesoft I have added [url]
Thanks a lot :)
Resolved using : 👍
<share-buttons
[title]="'Testing title'"
[url]="'https://facebook.com'"
[twitter]=false
[google]=false
[pinterest]=false
[linkedIn]=false
[tumblr]=false
[reddit]=false
[stumbleUpOn]=false
[whatsApp]=false
[description]="description"
[tags]="tags"
></share-buttons>
But I am not able to set : [shareTitle]="'Share Facebook Title'"
Getting Error : Can't bind to 'shareTitle' since it isn't a known property of 'share-buttons'.
I want to set dynamic title, desciption and imageUrl.
Please suggest.
Thanks
from ngx-sharebuttons.
[shareTitle]
and [totalCount]
have been removed in v2, as most users didn't use it anyway.
You want to use [title], [image] and [description] on <share-buttons>
to customize what is shared (note that some providers don't support image url ).
Current README.md
still need to be updated to reflect most of changes from v2.
Until then, you can have a look to source code directly and/or demo app, to see new usages.
from ngx-sharebuttons.
@RathodGirish I have updated both changelog and readme, I will close this for now
from ngx-sharebuttons.
Related Issues (20)
- SMS button opens Messages on Mac but without the URL HOT 3
- Instagram & Share launch Button HOT 2
- Discord button HOT 1
- skype button
- instagram button
- gmail button is not available HOT 1
- When click on Messenger and Viber nothing happens, link doesn't open HOT 1
- setting meta tags doesn't seem to matter? HOT 4
- Share via Mastodon HOT 1
- how to add role to given tag HOT 2
- Opened output not firing HOT 3
- Whatsapp redirection to 'api/web .whatsapp.com' controlled manually HOT 1
- :bug: v12.0.0 says tumblr and reddit are no longer available to use with shareButton directive
- can we open shared details in pop up instead of new tab ? HOT 2
- i am geting error with Angualr version 15 HOT 6
- How to use share buttons vertically? HOT 1
- share-buttons inputs don't work within square brackets. HOT 1
- add or replace twitter option for X HOT 5
- Unable to share image HOT 1
- Can't install; error with cdk version HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngx-sharebuttons.