0

I am pretty new to AngularJs. I have to toggle a section and used the ng-click like below:

                  <div class="panel panel-secondary scroll" href="#feedList-os" class="collapsedOs" ng-model="collapsedOs" ng-click="collapsedOs=!collapsedOs">
                      <ul id="feedList-app" class="list-group" ng-show="collapsedOs">
                        <li class="list-group-item clearfix">
                            <div class="panel panel-container scroll">
                               <button id="details" class="btn btn-danger" data-toggle="modal" data-target="#myModal">Details</button>
                            </div>
                        </li>
                    </ul>
                </div>

This is working fine as expected, but I have a button inside the div with class panel panel-container scroll has a button. I do not want the toggle logic to be applied for clicking the button. Even if I override the ng-click on the button, that's not overriding the default functionality.

0

1 Answer 1

1

If you add ng-click on the inner button, you can pass in an event object $event.

 <button id="details" class="btn btn-danger" data-toggle="modal" data-target="#myModal" ng-click='doWork($event)'>Details</button>

In the handler code you can do prevent bubble through for this event.

$scope.doWork($event) {
   $event.stopPropagation 
}
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.