diff options
Diffstat (limited to 'plugins/Morpheus/javascripts/piwikHelper.js')
-rw-r--r-- | plugins/Morpheus/javascripts/piwikHelper.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/plugins/Morpheus/javascripts/piwikHelper.js b/plugins/Morpheus/javascripts/piwikHelper.js index 163ea90160..f833b9e15f 100644 --- a/plugins/Morpheus/javascripts/piwikHelper.js +++ b/plugins/Morpheus/javascripts/piwikHelper.js @@ -125,6 +125,10 @@ var piwikHelper = { compileAngularComponents: function (selector) { var $element = $(selector); + if (!$element.length) { + return; + } + angular.element(document).injector().invoke(function($compile) { var scope = angular.element($element).scope(); $compile($element)(scope); @@ -132,6 +136,18 @@ var piwikHelper = { }, /** + * Detection works currently only for directives defining an isolated scope. Functionality might need to be + * extended if needed. Under circumstances you might call this method before calling compileAngularComponents() + * to avoid compiling the same element twice. + * @param selector + */ + isAlreadyCompiledAngularComponent: function (selector) { + var $element = $(selector); + + return ($element.length && $element.hasClass('ng-isolate-scope')); + }, + + /** * Displays a Modal dialog. Text will be taken from the DOM node domSelector. * Given callback handles will be mapped to the buttons having a role attriute * |