Giter Site home page Giter Site logo

Comments (8)

tinesoft avatar tinesoft commented on May 30, 2024

Hi @RathodGirish

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.

RathodGirish avatar RathodGirish commented on May 30, 2024

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.

tinesoft avatar tinesoft commented on May 30, 2024

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-buttons> 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.

RathodGirish avatar RathodGirish commented on May 30, 2024

Thanks a lot @tinesoft
That's working fine.

Now there are 2 problems while display button and sharing content.

capturefb issue

capturefb issue2

Thanks in advance :)

from ngx-sharebuttons.

tinesoft avatar tinesoft commented on May 30, 2024

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.

RathodGirish avatar RathodGirish commented on May 30, 2024

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.

tinesoft avatar tinesoft commented on May 30, 2024

[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.

MurhafSousli avatar MurhafSousli commented on May 30, 2024

@RathodGirish I have updated both changelog and readme, I will close this for now

from ngx-sharebuttons.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.