AngularJS directive for Live Helper Chat widget, enabling you to add data from within your AngularJS application to your LHC chat requests and emails.
1 person uses it
Author: 286972?v=3 jdforsythe

angular-live-helper-chat AngularJS live chat widget using Live Helper Chat.

This allows you to add extra input fields to the chat widget using data from within your AngularJS application.


Requires AngularJS Requires an active Live Helper Chat installation You must be using the "widget embed code" function of Live Helper Chat, not the "page embed code" function Usage

bower install angular-live-helper-chat Add angular-live-helper-chat.js script to your HTML Add angular-live-helper-chat as a module dependency to your app. Generate the embed code for your widget, as you'll need some of this information to set up the directive Log in to Live Helper Chat Choose Settings > Embed code > Live help embed code > Widget embed code Set all your options and refer to the code in step 5 Insert the live-helper-chat directive into your template: The options attribute value comes from the embed code:

LHCChatOptions.opt = {widget_height:340,widget_width:300,popup_height:520,popup_width:500}; The widget-url attribute is taken from the embed code, as well:

po.src='//'+referrer+'&l='+location; You must include everything from the // up to, but NOT including, the ? - the directive handles the referrer and location for you.

Custom Fields in Widget

In order to add the extra attributes, simply include the optional attrs and follow the array-of-objects syntax from Live Helper Chat:

// this example assumes you have a UserFactory that will return a user object, // but you can get the data to the directive just like any other app.controller('LHCController', ['$scope', 'UserFactory', function($scope, UserFactory) { var user = UserFactory.getCurrentUser();

}); Contributing

Please file issues and pull requests. I'd like to see this extended to allow setting the widget-url globally and to be a full service wrapper, allowing all of the different widgets Live Helper Chat provides.



comments powered by Disqus
This page was last updated almost 3 years ago.