diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2019-08-12 07:10:57 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-12 07:10:57 +0300 |
commit | 0eb6e352a2577594399e156c59a4f045efeeddf5 (patch) | |
tree | 850ab483011fed568e86ce9a3bca091f42e8e28a /plugins | |
parent | 30e355b8b94307fada904b182017f2bbf30348f5 (diff) |
Add JS event invoked after a widget is loaded for client side manipulation of widgets. (#14752)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/CoreHome/angularjs/widget-loader/widgetloader.directive.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins/CoreHome/angularjs/widget-loader/widgetloader.directive.js b/plugins/CoreHome/angularjs/widget-loader/widgetloader.directive.js index a4cbe3face..bda6b5d3b9 100644 --- a/plugins/CoreHome/angularjs/widget-loader/widgetloader.directive.js +++ b/plugins/CoreHome/angularjs/widget-loader/widgetloader.directive.js @@ -19,9 +19,9 @@ (function () { angular.module('piwikApp').directive('piwikWidgetLoader', piwikWidgetLoader); - piwikWidgetLoader.$inject = ['piwik', 'piwikUrl', '$http', '$compile', '$q', '$location', 'notifications']; + piwikWidgetLoader.$inject = ['piwik', 'piwikUrl', '$http', '$compile', '$q', '$location', 'notifications', '$rootScope', '$timeout']; - function piwikWidgetLoader(piwik, piwikUrl, $http, $compile, $q, $location, notifications){ + function piwikWidgetLoader(piwik, piwikUrl, $http, $compile, $q, $location, notifications, $rootScope, $timeout){ return { restrict: 'A', transclude: true, @@ -148,6 +148,13 @@ $compile(currentElement)(newScope); notifications.parseNotificationDivs(); + + $timeout(function () { + $rootScope.$emit('widget:loaded', { + parameters: parameters, + element: currentElement, + }); + }); })['catch'](function () { if (thisChangeId !== changeCounter) { // another widget was requested meanwhile, ignore this response |