I spoke a bit too soon.

Clicking 'outside' (ie, not on any of the menu items) should close any open 
menu.  I had been successfully using this technique 
<http://stackoverflow.com/questions/20186438/angular-click-outside-of-an-element-event>
 which 
(briefly) puts a directive on the outer container that looks like:
 link: function(scope, elem, attr, ctrl)
 {
   elem.bind('click', function(e) { e.stopPropagation(); });
   $document.bind('click', function() { scope.$apply(attr.clickedoutside); 
});
 }


That worked when I used ng-click in the template, but the *element.on* in 
the plunk doesn't seem to work.  I'm not an expert in the event model, but 
shouldn't the event trigger first go to the inner handler before going to 
the handler on the outer element?

Updated plunk showing problem 
<http://plnkr.co/edit/vV2OSPEG0i7WGB4JSrWy?p=preview>.  Comment out the 
e.stopPropagation() and the menus open (but clickoutside no longer works)

Danny



-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to