diff options
| author | Yoshie Muranaka <yoshiemuranaka@gmail.com> | 2019-06-14 12:21:19 -0500 |
|---|---|---|
| committer | Yoshie Muranaka <yoshiemuranaka@gmail.com> | 2019-06-14 12:27:01 -0500 |
| commit | e6bc9b2106d031c591bd10fbb19cb87a55e951ef (patch) | |
| tree | 832b068b189ea1bbe65f631e894e0d04c3bdeba5 /app/common/directives | |
| parent | 5bd1dec7fdc8f6a3a20e6c23dc491b3d31392bc5 (diff) | |
| download | phosphor-webui-e6bc9b2106d031c591bd10fbb19cb87a55e951ef.tar.gz phosphor-webui-e6bc9b2106d031c591bd10fbb19cb87a55e951ef.zip | |
Fix Unknown Provider error
This patchset will fix the Unknown Provider error
caused by the toggle-flag directive by declaring the
required $document dependency.
Tested: Navigated to Event Log page and no longer seeing
the error in the browser console.
Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com>
Change-Id: I446f0a1d120526dfa250862018dfa09b289cae74
Diffstat (limited to 'app/common/directives')
| -rw-r--r-- | app/common/directives/toggle-flag.js | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/app/common/directives/toggle-flag.js b/app/common/directives/toggle-flag.js index 008097c..6ac5fff 100644 --- a/app/common/directives/toggle-flag.js +++ b/app/common/directives/toggle-flag.js @@ -1,29 +1,31 @@ window.angular && (function(angular) { 'use strict'; - angular.module('app.common.directives') - .directive('toggleFlag', function($document) { - return { - restrict: 'A', - link: function(scope, element, attrs) { - function elementClick(e) { - e.stopPropagation(); - } + angular.module('app.common.directives').directive('toggleFlag', [ + '$document', + function($document) { + return { + restrict: 'A', + link: function(scope, element, attrs) { + function elementClick(e) { + e.stopPropagation(); + } - function documentClick(e) { - scope[attrs.toggleFlag] = false; - scope.$apply(); - } + function documentClick(e) { + scope[attrs.toggleFlag] = false; + scope.$apply(); + } - element.on('click', elementClick); - $document.on('click', documentClick); + element.on('click', elementClick); + $document.on('click', documentClick); - // remove event handlers when directive is destroyed - scope.$on('$destroy', function() { - element.off('click', elementClick); - $document.off('click', documentClick); - }); - } - }; - }); + // remove event handlers when directive is destroyed + scope.$on('$destroy', function() { + element.off('click', elementClick); + $document.off('click', documentClick); + }); + } + }; + } + ]); })(window.angular); |

