Comments (10)
Hi @PardeepJain, can you show your code?
ShareButtons checks the URL if its valid on ngAfterViewInit
, if not it will use window.location.href
, when you change the URL dynamically, it will not be checked but it should work with the URL as you changed it.
@Input() url: string;
ngAfterViewInit() {
if (this.url) {
let r = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
if (!r.test(this.url)) {
console.warn('ShareButtons: Invalid URL, switching to window.location.href');
this.url = this.window ? this.window.location.href : typeof global != 'undefined' ? (<any>global).url : '';
}
}
else {
this.url = this.window ? this.window.location.href : typeof global != 'undefined' ? (<any>global).url : '';
}
}
from ngx-sharebuttons.
According to you if ill not provide URL attribute than it will automatically share Current URL ?
as of now i am using like this without url
like this
<share-buttons [reddit]="false" [stumbleUpOn]="false"></share-buttons>
but still not working as expected ,
i am at url http://localhost:4200/#/XYZ/191
but share url showing only http://localhost:4200/#/
why so ?
PS:- I am using hashlocationstrategy
from ngx-sharebuttons.
@PardeepJain the issue is with the hashlocationstrategy
, currently it will work if you disable the hash, but I will look for it once I get free time and let you know when it's fixed, thanks for letting me know.
from ngx-sharebuttons.
@MurhafSousli is there any time line when will you resolve this bug ? its urgent for me to use this in hashlocationstrategy
from ngx-sharebuttons.
@PardeepJain Unfortunately, I'm busy atm, but if you are in a hurry you can try the following solution until I push the update,
1 - copy the package source files to your project directory
2 - import ShareButtonsModule
locally (not from node_modules dir)
3 - go to share-button.component.ts and just replace window.location.href
with encodeURIComponent(window.location.href)
like this
ngAfterViewInit() {
if (this.url) {
let r = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
if (!r.test(this.url)) {
console.warn('ShareButtons: Invalid URL, switching to window.location.href');
this.url = this.window ?
encodeURIComponent(this.window.location.href)
: typeof global != 'undefined' ? (<any>global).url : '';
}
}
else {
this.url = this.window ?
encodeURIComponent(this.window.location.href) :
typeof global != 'undefined' ? (<any>global).url : '';
}
.....
Hope this helps
from ngx-sharebuttons.
When i am setting Dyanmic Url to share button let suppose
https://mywebsite.com/#/abc/234
than your share button will share url only as
https://mywebsite.com
instead of sharing Full URL address.PS: Binding is dynamic from Rest API.
@MurhafSousli same issue, I am using latest pakage 7.1.4 .... I have tried many thing as per documentation from last 1 day...but it is not solved
getting problem for linked in and facebook - url I am trying to share is - https://xyz.com/#/share/poster/1354 ....when sharing on linkedin and facebook....it is not sharing url ...just showing or sharing https://xyz.com
Expected Result on facebook and linkedin sharing is - share same url https://xyz.com/#/share/poster/1354
Please look into this and help me to solve this....please let me know in case of any other information you needed
from ngx-sharebuttons.
@kuldeep89 Please upgrade to the latest version 8.0.0-beta.3
, see the instruction in #432
from ngx-sharebuttons.
@MurhafSousli tried with beta version too...still getting same issue..
@kuldeep89 Please upgrade to the latest version
8.0.0-beta.3
, see the instruction in #432
checked and tried with beta version too...still getting same issue
from ngx-sharebuttons.
Hi @MurhafSousli,
I am also trying with version 8.0.2 but still my url is not coming fully for Facebook and linkedin. For Twitter n Whatsapp working fine. I am using url as http://xyz.com/share/ADGT67S, for facebook coming as http://xyz.com
from ngx-sharebuttons.
@prachip This seems to be a different issue, please use a new issue, fill the template and add a reproduction stackblitz
from ngx-sharebuttons.
Related Issues (20)
- 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
- Required Old Twitter Logo Update | 'X' HOT 2
- Updating to Angular 17 HOT 4
- share my articles in linkedin with preview image HOT 2
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.