JSFiddle - React, Tailwind, and code Playground
HTML
<body ng-app="Test">
<section ng-controller="TestCtrl as ctrl">
<div class="square" ng-click="ctrl.divClick()">
<span>My text</span>
<button ng-click="ctrl.buttonClick($event)" >My button</button>
</div>
</section>
</body>
CSS
.square {
width: 300px;
height: 200px;
border: 2px solid blue;
background-color: grey;
}
JavaScript
(function() {
var app = angular.module('Test', []);
app.controller('TestCtrl', [function() {
this.divClick = function() {
alert('div clicked');
};
this.buttonClick = function(e) {
e.stopPropagation();
alert('button clicked');
}
}]);
})();