J
J
jack3d2015-05-25 13:30:42
Angular
jack3d, 2015-05-25 13:30:42

How to hide div when outside is clicked?

Div, when clicked, we show the second div:

<div class="first pull-right h-btn" data-ng-if="user" data-ng-click="viewModel.showLogout = !viewModel.showLogout">

<div class="second"  data-ng-if="viewModel.showLogout" data-ng-click="logout()">
                    <a href="javascript:void(0)">Log out</a>
                </div>

How to hide a div with class="second" when outside is pressed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Tartmin, 2015-05-25
@baskerville42

If I deciphered you correctly, then you need it? jsfiddle.net/Baskerville42/ex03v2j2

<div ng-app>
    <div ng-click="Ctrl.showLogout = !Ctrl.showLogout">Певый div (Ctrl.showLogout = {{Ctrl.showLogout}})</div>
    <div ng-if="!Ctrl.showLogout" class="second">Log out</div>
</div>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question