angular-salesforce
v1.1.2
Published
An Angular.js wrapper for Salesforce providing a simple and familiar API for Angular Developer.
Downloads
2
Readme
angular-salesforce
An Angular.js wrapper for Salesforce providing a simple and familiar API for Angular Developer.
#How do I add this to my project?
You can download angular-salesforce
by:
- (prefered) Using npm and running
npm install angular-salesforce --save
- Downloading it manually by clicking here to download development (unminified) (minified)
Example
Here is a simple which allows you to include your own deploymentId
and organisationId
to test. Below is a quick start guide. Use either $salesforce
or Salesforce
service depending on your preference and opinions.
<!-- I'm using angular 1.5.9+ but any version should work -->
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.9/angular.js"></script>
<!-- include this module after angular.js -->
<script src="node_modules/angular-salesforce/angular-salesforce.js"></script>
<script>
angular.module('salesforceApp', [
'ngSalesforce'
])
// Configure your $salesforce module
.config(function($salesforceProvider) {
$salesforceProvider
.buttonId('uniqueId')
.onlineButtonId('liveagent_button_online_uniqueId')
.offlineButtonId('liveagent_button_offline_uniqueId')
.chatUrl('https://domain.salesforceliveagent.com/chat')
.deploymentId('deploymentId')
.organisationId('organisationId')
})
// init $salesforce
.run(function ($salesforce) {
$salesforce.init()
})
.controller('MainCtrl', function($scope, $salesforce) {
$scope.launchChat = function () {
$salesforce.startChatWithWindow('uniqueId')
}
});
</script>
<body>
<div ng-controller="MainCtrl">
<button
type="button"
id="liveagent_button_online_uniqueId"
style="display:none;"
ng-click="launchChat()">Start chat</button>
<div id="liveagent_button_offline_uniqueId" style="display:none;">Service not available</span>
</div>
</div>
</body>