// ### DEPRECATED ###
// ------------------------------------------------------------------------------------------
// LacunaWebPKI: first AngularJS example
function ExampleController($scope) {
$scope.notInstalledMessage = '';
$scope.showNotInstalledPanel = false;
$scope.logs = [];
var pki = new LacunaWebPKI({
license: 'ASYAanNmaWRkbGUubmV0LHdlYnBraS5sYWN1bmFzb2Z0d2FyZS5jb20AAAABClKvO1J22vAD+YmfANiKQLbcLE1lNraPKCel6tRM+ZxR+h6M/crtJYRRVGGz7hrdbM0Y0mfTu15RMYGqQMi1QNZS6GrT4vNzIayv552Fl0EFWQA7jWlctUwfYoHRHVEnCNx9YGXDiA9+yDoGlVwgTR7fjzNeS3Fen1MVIyKBF464gN0JvdiCRJMI47JGVDkPmKjcrYIvJs6y5Lg25RW4ZnBKVruS+HR2s3k8ZrV4y4RCQE4UYMKbukF9vsF+JqAEifRlPq2xLcrNdxBveVDSXS/LRHAcrZrMM+Iw4A79jl0ngWPcy+CwinAhT+3dxVo5ZWMRQFpmTkylEMDvTjV9wQ==',
angularScope: $scope, // notice that we're passing our $scope to the LacunaWebPKI object
defaultError: function (message, error, origin) {
log('Web PKI error originated at ' + origin + ': ' + error);
alert('Web PKI error: ' + message);
}
});
$scope.start = function () {
log('Checking component installation ...');
pki.checkInstalled({
installed: onWebPkiDetected,
notInstalled: onWebPkiNotInstalled
});
};
var onWebPkiNotInstalled = function (status, statusMsg) {
log('Component not installed or outdated');
// This callback will be called properly inside angular's "cycles" because we've passed
// a reference of our $scope to the LacunaWebPKI object. That means our changes to the
// $scope will be reflected on the view as expected.
$scope.notInstalledMessage = statusMsg;
$scope.showNotInstalledPanel = true;
};
$scope.redirectToInstall = function() {
pki.redirectToInstallPage();
};
var onWebPkiDetected = function () {
log('Component detected');
alert('We are good to go!');
};
var log =...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.