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: '/' | |
}); | |
} | |
} | |
); | |
} | |
} | |
}); |
This comment has been minimized.
This comment has been minimized.
popup opens but its not aunthicate, Its not connect with he App |
This comment has been minimized.
This comment has been minimized.
can someone help me on this. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
It is not work for me. After new window opened, window immidiately redirected to grant URL. What i'm doing wrong?