I'm pursuing an issue as I wanted to add a class to the selected li and to 
the parent li after a click. we don't want to use template or templateURL 
in the directive as I want to use plain HTML menu with angular menu 
selection.

I have tried but no luck. Can we achieve this using some tricky way?

*HTML*

 <ul>
    <li>
        Menu1
        <ul>
            <li menu>Submenu11</li>
            <li menu>Submenu12</li>
            <li menu>Submenu13</li>
        </ul>
    </li>
    <li>
        Menu 2
        <ul>
            <li menu>Submenu21</li>
            <li menu>Submenu22</li>
            <li menu>Submenu23</li>
        </ul>
    </li></ul>

*Angular*

 .directive("menu", function () {       
      return {
        restrict: 'EA',      
        link: function(scope, elem, attrs) {
            angular.element(document.querySelector('.menu li 
li')).removeClass('no-select');
            elem.bind("click", function() {
                elem.addClass('no-select');
            });             

        }
      }

  });

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to