Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

329
Views
Tanto los divs externos como los internos tienen ng-click y cuando hago clic en el div interno, ambos ng-clicks se ejecutan. ¿Cómo prevenir eso?

Tengo 2 divs, uno externo y otro interno que tienen ng-click adjunto a ambos. Cuando trato de hacer clic en el div interno, ambas funciones se ejecutan (supongo que porque esencialmente también estoy haciendo clic en el div externo porque contiene el interno). ¿Cómo puedo evitar que se ejecute la función del div externo al hacer clic en el div interno?

 <div ng-click="vm.showMoreHandler()"> <div ng-click="vm.actionHandler($event, action)"></div> </div>
about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Puede usar event.stopPropagation() para evitar que burbujee

 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>

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!