$addthisProvider
addthis
A provider for handling AddThis actions before you app has started running.
Sets the addthis_config
variable on the page. If the pubid is set
it take it an use it elsewhere. Otherwise, it will add in the
previously set profile ID (if set) to addthis_config.pubid
. See
the addthis_config variable documentation for options.
If the site's profile ID is set somehow through the addthisProvider
(such as here), then adding addthis_widget.js manually onto your
page is optional.
Param | Type | Details |
---|---|---|
input | object | AddThis configuration object. See the addthis_config variable documentation for options. |
object | Returns addthis general configuration object |
app.config(function($addthisProvider) {
var cfg = {
'services_exclude': 'print,mailto',
'ui_language': 'pl',
'data_track_clickback': false,
'ui_508_compliant': true,
'pubid': 'your_profile_id_here'
};
$addthisProvider.config(cfg);
});
If not added onto the page manually, this module automatically adds
addthis_widget.js
onto the site (if not added manually). Calling
this function will disable this functionality. The
addthis_widget.js
script can be added later by calling
$addthis.add
. AddThis tools will not function until
addthis_widget.js
is added onto the page.
app.config(function($addthisProvider) {
$addthisProvider.disableAutoAdd();
});
addthisProvider object | Returns the $addthisProvider object |
By default, this module automatically adds addthis_widget.js
onto
the site (if not added manually). The
$addthisProvider.disableAutoAdd
method disables this
functionality. This method re-enables it.
app.config(function($addthisProvider, $envProvider) {
$addthisProvider.disableAutoAdd();
if ($envProvider.isProduction()) {
$addthisProvider.enableAutoAdd();
}
});
addthisProvider object | Returns the $addthisProvider object |
Changes the environment out of which the addthis_widget.js script is included. Defaults to AddThis's production environment. Environments test, dev and local are only available inside AddThis firewalls for use by AddThis developers. The unittest environment is used during unit testing. Any other value will set things up for production.
app.config(function($addthisProvider, $envProvider) {
$addthisProvider.environment('unittest');
});
Param | Type | Details |
---|---|---|
env | string | The environment to use. Defaults to production. |
string | Returns the url for addthis_widget.js |
Setter function for the site's AddThis profile ID.
If the site's profile ID is set somehow through the addthisProvider
(such as here), then adding addthis_widget.js manually onto your
page is optional.
Param | Type | Details |
---|---|---|
input | string | The AddThis profile ID to use on this site. |
boolean|string | Returns the profile id or false if not set |
app.config(function($addthisProvider) {
$addthisProvider.profileId('your_profile_id_here');
});
By default, this module automatically adds addthis_widget.js
onto
the site towards the bottom of the DOM (if not added manually). This
function will change that and append addthis_widget.js
onto the
DOM's <HEAD>
element
app.config(function($addthisProvider, $envProvider) {
$addthisProvider.scriptInHead();
});
addthisProvider object | Returns the $addthisProvider object |
Takes a twitter handle/username and uses it for twitter via. See https://www.addthis.com/academy/changes-to-how-twitter-works-with-addthis/ for more information
Param | Type | Details |
---|---|---|
the | stringfalse | twitter handle in a string or false to remove twitter handle from config |
app.config(function($addthisProvider) {
$addthisProvider.twitterVia('addthis');
});
Takes a URL shortening name and a social service name, then enables URL shortening on that social service using the url shortening service. https://www.addthis.com/academy/url-shortening/ for more information
Param | Type | Details |
---|---|---|
urlShorteningService | string | The URL shortening service to enable |
socialService | string | The social service to enable the URL shortening on |
app.config(function($addthisProvider) {
$addthisProvider.urlShortening('bitly', 'twitter');
});