code: function link(scope, elem, attrs) {
        var componentId = attrs.mdComponentId || 'mainMenu';
        var mainContentArea = $document[0].querySelector(attrs.mainContent || 'main');
  
        $rootScope.$on('$locationChangeSuccess', openPage);
  
        /**
         * @ngdoc function
         * @name openPage
         * @methodOf mainMenu.directive:
         * @description
         * Open a page
         */
        function openPage() {
          $mdSidenav(componentId)
            .close()
            .then(mainContentArea.focus());
        }
      }
docs: directives link definition