Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

angularjs Both outer and inner divs have ng-click and when I click on the inner div, both ng-clicks execute. How to prevent that

angular.module('myApp', [])
  .controller('myCtrl', ['$scope', function($scope) {
    $scope.showMoreHandler = function(e) {
      console.log('showMoreHandler');
    }
    $scope.actionHandler = function(e) {
      e.stopPropagation();
      console.log('actionHandler');
    }

  }]);
div {
  padding: 20px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5/angular.min.js"></script>
<div ng-app="myApp" ng-controller="myCtrl">
  <div ng-click="showMoreHandler($event)">showMoreHandler
    <div ng-click="actionHandler($event)">actionHandler</div>
  </div>
</div>
Comment

PREVIOUS NEXT
Code Example
Javascript :: Why is this forEach code snippet invalid in AngularJS 
Javascript :: angularjs Uncaught ReferenceError: myFunction is not defined at HTMLInputElement.onkeyup 
Javascript :: ! function in javascript 
Javascript :: AngularJS w/Prerender 404 error on home page 
Javascript :: tabbarbadge style react native 
Javascript :: AngularJs - Display Validation Message within Component 
Javascript :: AngularJS Pagination not showing all pages 
Javascript :: set default value in dynamic dropdown angularjs 
Javascript :: StaticInjectorError exception for user defined HttpInterceptor 
Javascript :: react-native navigation stack set push component then cover parent page 
Javascript :: Check if a user joins, leaves, or moves channels discord.js 
Javascript :: RegEx Pattern Validations failing on html input 
Javascript :: access language in request express 
Javascript :: how to build a nested, dynamic JSON in Go 
Javascript :: request submit form 
Javascript :: insert image in jsp page 
Javascript :: open div with onClick element position 
Javascript :: slow down an action or event 
Javascript :: angular 13 deploy on tomcat 9 
Javascript :: get longi and long with an adress react 
Javascript :: how to chaage background color of any element from java script 
Javascript :: import local js file node 
Javascript :: react_devtools_backend.js:4026 Warning: Cannot update a component (`BrowserRouter`) while rendering a different component (`Login`). 
Javascript :: dayofyear mongodb 
Javascript :: combining not selector with other jquery 
Javascript :: How to sum to small numbers 
Javascript :: vue append component to div 
Javascript :: get the first recurring character javascript 
Javascript :: Backbone Template Simple Example 
Javascript :: java script strict mode 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =