An object that represents a promise to be fulfilled, through which the programmer can register callbacks for when the promise is fulfilled successfully or for when an error occurrs.
All asyncronous methods from the LacunaWebPKI class return an instance of this object.
For instance, the method listCertificates returns a promise which is fulfilled when the list of certificates is finally available.
You could register a callback for when that happens, and another one for if an error occurs, in the following manner:
pki.listCertificates()
.success(function(certs) {
// Every success callback receives a single argument. Its type (either string, array or object) and meaning depend on the method that returned the promise.
$scope.certificates = certs;
})
.fail(function (ex) {
// The fail callback always receives an ExceptionModel object.
alert('pki error from ' + ex.origin + ': ' + ex.message);
console.log('pki error', ex);
});
An object that represents a promise to be fulfilled, through which the programmer can register callbacks for when the promise is fulfilled successfully or for when an error occurrs. All asyncronous methods from the LacunaWebPKI class return an instance of this object.
For instance, the method listCertificates returns a promise which is fulfilled when the list of certificates is finally available. You could register a callback for when that happens, and another one for if an error occurs, in the following manner:
pki.listCertificates() .success(function(certs) { // Every success callback receives a single argument. Its type (either string, array or object) and meaning depend on the method that returned the promise. $scope.certificates = certs; }) .fail(function (ex) { // The fail callback always receives an ExceptionModel object. alert('pki error from ' + ex.origin + ': ' + ex.message); console.log('pki error', ex); });