Skip to content

chesleybrown/uservoice-trigger-directive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

uservoice-trigger-directive

Build Status Dependency Status devDependency Status NPM version

Simple directive to trigger a UserVoice widget. It automatically loads the UserVoice widget for you as well.

Install with Bower

bower install uservoice-trigger-directive

Include the directive in your Angular module and config it

var myApp = angular
	.module('myApp', ['uservoice-trigger'])
	.config(function ($userVoiceProvider) {
		// you must set this to your unique UserVoice Javascript API Key which
		// can be found under your UserVoice -> Settings -> Widgets section on
		// their site
		$userVoiceProvider.defaults.key = 'rarAZzmdEeibkRTbaRROi'; // this is only an example api key
	})
	.controller('MyCtrl', function (UserVoice) {
		// Setup your UserVoice here, etc
	})
;

Usage

Use the uservoice-trigger directive attribute on the element you want to trigger the UserVoice widget on click. You also can change the mode used by setting the mode attribute to one of contact, smartvote or satisfaction (see UserVoice docs for more information on the widget options). It is also possible to set the position attribute to determine which direction the widget will appear (default is automatic).

NOTE: uservoice-trigger module now automatically loads the UserVoice widget, so you won't have to add it yourself anymore.

Examples

<a uservoice-trigger mode="contact">Contact</a>
<a uservoice-trigger mode="smartvote" position="top">Vote</a>
<a uservoice-trigger mode="smartvote" position="top" identify="identify">Vote</a>

Running Tests

To execute all the tests, just run:

npm test