Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
angularjs directive to show the quickbooks connect button
'use strict';
angular.module('thirdParty')
.directive('connectToQuickbooks', function($window){
return {
restrict: 'E',
template: "<ipp:connectToIntuit></ipp:connectToIntuit>",
link: function(scope) {
var intuitScriptLoaded = function(){
return $window.intuit
&& $window.intuit.ipp
&& $window.intuit.ipp.anywhere
&& $window.intuit.ipp.anywhere.setup;
};
if (intuitScriptLoaded()) {
// Hack to get the button to reload when this directive is shown
// for the second time, since the QB connect button assumes that
// the button is not rendered dynamically
$window.intuit.ipp.anywhere.init();
} else {
var script = $window.document.createElement("script");
script.type = "text/javascript";
script.src = "//js.appcenter.intuit.com/Content/IA/intuit.ipp.anywhere.js";
$window.document.body.appendChild(script);
}
scope.$watch(
intuitScriptLoaded,
function(newValue, oldValue) {
if(intuitScriptLoaded()) {
$window.intuit.ipp.anywhere.setup({
grantUrl: '/'
});
}
}
);
}
}
});
@MaximKitsenko

This comment has been minimized.

Show comment
Hide comment
@MaximKitsenko

MaximKitsenko Oct 27, 2014

It is not work for me. After new window opened, window immidiately redirected to grant URL. What i'm doing wrong?

MaximKitsenko commented Oct 27, 2014

It is not work for me. After new window opened, window immidiately redirected to grant URL. What i'm doing wrong?

@hdeliwala

This comment has been minimized.

Show comment
Hide comment
@hdeliwala

hdeliwala Aug 10, 2016

popup opens but its not aunthicate, Its not connect with he App

hdeliwala commented Aug 10, 2016

popup opens but its not aunthicate, Its not connect with he App

@hdeliwala

This comment has been minimized.

Show comment
Hide comment
@hdeliwala

hdeliwala Aug 10, 2016

can someone help me on this.
Thanks in advance

hdeliwala commented Aug 10, 2016

can someone help me on this.
Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment