I managed to connect a custom script.
When i use the custom button, the script runs successfully.
But unfortunately it is not called when logout when I use the default button (from component camunda-commons-ui)
'use strict';
define('custom-ng-module', [
'angular'
], function (angular) {
var customModule = angular.module('my.custom.module', []);
customModule.controller('camHeaderViewsCtrl', ['scope', function ($scope) {
$rootScope.logout = function (){
console.log('Test');
};
}]);
return customModule;
});
Could you help me to override the default script for my custom script?
is that script supposed to run without any custom buttons (i.e. using the default logout button in the web app)? I tried adding it and registering it as in the doc and it doesn’t seem to be called at all
Hi there,
I’ve got the same problem. Is there anyone with a solution? I know nothing about Angular… It feel that it can’t be that hard to change such a simple behaviour. But I just don’t know how…
'use strict';
define('custom-logout', ['angular'], function (angular) {
var customLogoutModule = angular.module('custom-logout', []).run(
['$rootScope', function ($rootScope) {
$rootScope.$on('$viewContentLoaded', function (event) {
// Get the HTML element of the header widget.
var div = document.querySelector("[cam-widget-header]");
// Get the only property on it, its key is jQuery<many numbers> and its value
// contains the controller ($camWidgetHeaderController) and the isolated
// Scope ($isolateScope). The logout function is defined in this scope.
var jQueryKey = Object.getOwnPropertyNames(div)[0];
var $isolateScope = div[jQueryKey]['$isolateScope'];
$isolateScope.logout = function () {
// Do whatever you want to do on logout.
window.location.href = "/logout"
}
})
}]);
});