javascript - write custom function for navigation angularjs -


So I have a navigation that I want a dropdrown menu with sub menu functionality on it I can show and hide the menu I tried to ng-show, but then I would have to go back and hide the item again to click on it again. I want to be able to click to show me, then click anywhere to hide it.

Trying to use ng-click, but I'm not sure why I should have my custom function that I want to get regardless of the controller being used.

Would I put such a directive in such a way? The function is not calling the HTM or any type of material such as a factory is usually, it only shows and hides the content at different click events.

Probably there are more complex ways of doing this that can be more beautiful, but let me move it in the past Got to do Let's assume that you are loading before anybody, so $ is complete jQuery. If you are doing this with many different DOOM elements, then you can be more effective to break it into a factory, which allows multiple objects to register themselves in this way, of which only one Code to body . () Click $ {'(body'). Function (evt) {var $ elem = $ (elem); Var $ target = $ (evt.target); If ($ elem.is ($ target) || $ elem.has ($ target). Length> 0) return; $ Elem.hide ();})}}}});


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -