Giter VIP home page Giter VIP logo

addthis-angularjs's Introduction

official-addthis-angularjs logo

Grow your website with tools trusted by over 15 million sites. The AddThis AngularJS module includes a directive, service, and provider. It is smart about route/location changes and the AngularJS digest cycles and how they affect AddThis tools. This module requires a free AddThis account and is compatible with free and paid plans. If you're struggling with instructions, we keep the AngularJS install instructions on the AddThis Academy up to date.

Installation

Visit addthis.com to sign in or sign up before proceeding to the next steps.

You can install AddThis for AngularJS from addthis.com, NPM, Bower, or Yarn, among other places. Follow the instructions below for your preferred method.

NPM

Add it to the project

npm install --save @oracle/addthis-angularjs

Yarn

Add it to the project

yarn add @oracle/addthis-angularjs

Bower

Add it to the project

bower install --save addthis-angularjs

Setup

Include the file in HTML

<script src="path/to/@oracle/addthis-angularjs/dist/official-addthis-angularjs.js"></script>

Add addthis to the module's dependencies

var app = angular.module('MyApp', ['addthis']);

When you create an account on addthis.com, we assign you a profile ID to provide analytics, configure settings, etc. To find your profile ID, log in to your addthis.com account, select the three dots in the top navigation, select "More," and identify your profile ID in the "General" section. Select an option below to set up your profile ID for the module.

Set a Profile ID: Option 1: HTML

Include addthis_widget.js in HTML with an AddThis profile ID. Replace YOUR_PROFILE_ID below with a profile ID.

<!-- Go to www.addthis.com/dashboard to customize your tools -->
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=YOUR_PROFILE_ID"></script>

Get a profile ID with a free AddThis account.

Set a Profile ID: Option 2: $addthisProvider.profileId

Set the profile ID and just the profile ID.

app.config(function($addthisProvider) {
    $addthisProvider.profileId('YOUR_PROFILE_ID');
});

Get a profile ID with a free AddThis account.

Set a Profile ID: Option 3: $addthisProvider.config

Set other addthis_config settings with the profile ID. See addthis_config documentation for additional options.

app.config(function($addthisProvider) {
    var cfg = {
        'pubid': 'YOUR_PROFILE_ID'
    };
    $addthisProvider.config(cfg);
});

Get a profile ID with a free AddThis account.

Usage

Basic

<div addthis-tool tool-class="'addthis_sharing_toolbox'">

Replace addthis_sharing_toolbox with the name for the AddThis inline tool desired.

Specify a URL or title other than the current page's

Individually Per Tool

<div
    addthis-tool
    tool-class="'addthis_sharing_toolbox'"
    share-url="'http://example.com'"
    share-title="'Check this out:'"
>

Replace addthis_sharing_toolbox with the name for the AddThis inline share tool desired. If you’re adding inline buttons or Tip Jar buttons, replace addthis_inline_share_toolbox with the class for the desired tool. To get the class name, visit your addthis.com dashboard, add a tool, navigate to the Get The Code page, and identify the class name in Step 3 on the Get The Code page.

Replace http://example.com with the URL to share when a visitor clicks on one of the sharing buttons, or, alternately, leave the share-url attribute out completely. You can use a variable here, ex: share-url="shareUrlFromMyScope".

Replace Check this out: with the title to share when a visitor clicks on one of the sharing buttons, or, alternately, leave the share-title attribute out completely. You can use a variable here, ex: share-title="shareTitleFromMyScope".

Note: Some services (such as Facebook) do not allow you to define the share title for a URL. Facebook will always use the Open Graph tags it finds on the page when it crawls it. You can use the Facebook Sharing Debugger to test your Open Graph tags.

For Every Tool

app.controller('MyCtrl', ['$scope', '$addthis', function($scope, $addthis) {
    $addthis.share_url('http://example.com');
    $addthis.share_title('Check this out:');
}]);

Replace http://example.com with the URL to share when a visitor clicks on one of the sharing buttons.

Replace Check this out: with the title to share when a visitor clicks on one of the sharing buttons.

This will not override the share URL or title for tools using the share-url and share-title directive attributes.

More Resources

addthis-angularjs's People

Contributors

arnavarro avatar dmvjs avatar emilykschwartz avatar flashpuller avatar gnurik avatar jpierront avatar sirius226 avatar taojing10 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

addthis-angularjs's Issues

Blank page when using Share Email in Hebrew

When using Share Email in hebrew, I get a blank page. It LOOKS like the reason is because there's an improperly formatted quotation mark " in the sendWithDifferentServices section of translations_table .

image

Sample URL: https://www.addthis.com/tellfriend_v2.php?v=300&winname=addthis&pub=atacademy&source=tbx-300&lng=en&s=email&wid=fhss&url=http%3A%2F%2Fwww.addthis.com%2Facademy%2Fadd-email-share-buttons-newsletter%2F&title=How%20To%20Add%20Email%20Share%20Buttons%20To%20Your%20Newsletter%20-%20AddThis%20Academy&ate=AT-atacademy/-/per-2/59abbee51abe3bad/2&uid=59abbc10ffcb171a&description=NOTE%20FOR%20EXISTING%20USERS%3A%20We%20recently%20made%20some%20changes%20to%20our%20tool%20gallery%2C%20and%20one%20of%20those%20changes%20included%20moving%20the%20Email%20Newsletter%20buttons%20to%20a%20purely%20code%20installation%20as%20opposed%20to%20being%20able%20to%20configure%20and%20edit%20in%20the%20dashboard.%20If%20you%20have%20buttons%20already%20in%20your%20newsletter%2C%20we%20will%20continue%20to%20support%20them.%20%E2%80%A6%20Continue%20reading%20How%20To%20Add%20Email%20Share%20Buttons%20To%20Your%20Newsletter%20%E2%86%92&uud=1&ct=1&ui_email_to=&ui_email_from=&ui_email_note=&pre=http%3A%2F%2Fwww.addthis.com%2Facademy%2F%3Fs%3Dshare%2Bemail&tt=0&captcha_provider=recaptcha2&pro=0&ats=imp_url%3D0%26smd%3Drsi%253D%2526gen%253D0%2526rsc%253D%2526dr%253Dhttp%25253A%25252F%25252Fwww.addthis.com%25252Facademy%25252F%25253Fs%25253Dshare%25252Bemail%2526sta%253DAT-atacademy%25252F-%25252F-%25252F59abbee51abe3bad%25252F1%26hideEmailSharingConfirmation%3Dundefined%26service%3Demail%26media%3Dundefined%26passthrough%3Dundefined%26email_template%3Dundefined%26email_vars%3Dundefined&atc=username%3Datacademy%26services_exclude%3D%26services_exclude_natural%3D%26services_compact%3Dfacebook%252Ctwitter%252Cprint%252Cemail%252Cpinterest_share%252Cgmail%252Cgoogle_plusone_share%252Clinkedin%252Cmailto%252Ctumblr%252Cmore%26product%3Dtbx-300%26widgetId%3Dfhss%26pubid%3Datacademy%26ui_pane%3Demail&rb=false

Publish last version to NPM

Hi there, I'm having some troubles using your library on production, this error appears:
Uncaught Error: [$injector:unpr] Unknown provider: tProvider <- t <- $addthis <- $addthis
I'm using AngularJS 1.6.9 and the building system is Webpack 3.10.0.

It looks like someone already opened an issue about that, and it was fixed on the last version of the package (1.0.4) though, as it hasn't been published to NPM, I can't upgrade without reinstalling the dependency as a repository.

this._targetWindow.postMessage is not a function.

I'm getting error:
this._targetWindow.postMessage is not a function. (In 'this._targetWindow.postMessage(e,this._targetOrigin)', 'this._targetWindow.postMessage' is undefined)

in many Safari and mobile Safari versions: Safari 11.0.1, Mobile Safari 11.0, Safari 9.1.3, WebKit 604.1.38 (iOS 11.0.3)

I'm not sure if it's tied to this module or some other setting, but I do have another addthis angular module and pub key that is working as expected.

I've also submitted a ticket to addthis support. #284024

addthis-issue

plnkr example:
https://plnkr.co/edit/JjemqFppQqM1n6OQ0GB1?p=preview (click the more button to open the widget)

Unable to Minifiy / Concat / Package for Production.

When I try to build this for production I get the following error.

Uncaught Error: [$injector:unpr] Unknown provider: eProvider <- e <- $addthis <- $addthis
http://errors.angularjs.org/1.5.11/$injector/unpr?p0=eProvider%20%3C-%20e%20%3C-%20%24addthis%20%3C-%20%24addthis
at vendor-6ed59de381.js:31
at vendor-6ed59de381.js:31
at Object.n [as get] (vendor-6ed59de381.js:31)
at vendor-6ed59de381.js:31
at n (vendor-6ed59de381.js:31)
at i (vendor-6ed59de381.js:31)
at Object.o [as invoke] (vendor-6ed59de381.js:31)
at vendor-6ed59de381.js:31
at n (vendor-6ed59de381.js:31)
at i (vendor-6ed59de381.js:31)
at Object.o [as invoke] (vendor-6ed59de381.js:31)
at vendor-6ed59de381.js:31
at n (vendor-6ed59de381.js:31)
at it (vendor-6ed59de381.js:31)
at o (vendor-6ed59de381.js:31)

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.