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
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();
- }
-
- function documentClick(e) {
- scope[attrs.toggleFlag] = false;
- scope.$apply();
- }
-
- 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);
- });
+ 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();
+ }
+
+ 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);
+ });
+ }
+ };
+ }
+ ]);
})(window.angular);