Change navigation structure

Change-Id: I12c819293ce1eda188dc9f257ae9370f1b73cb18
Signed-off-by: Iftekharul Islam <iislam@us.ibm.com>
diff --git a/app/common/directives/toggle-flag.js b/app/common/directives/toggle-flag.js
new file mode 100644
index 0000000..aca09ca
--- /dev/null
+++ b/app/common/directives/toggle-flag.js
@@ -0,0 +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);
+                    });
+                }
+            };
+        });
+})(window.angular);
\ No newline at end of file