JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<div ng-app="app" ng-controller="Ctrl">
<div class="parent">
<div ng-click="myFunc1()">Click Me!</div>
</div>
<button ng-click="stopFunc()">Cancel</button>
</div>
CSS
.parent {
height: 100px;
width: 200px;
background: skyblue;
border: 1px solid lightgrey;
border-radius: 5px;
padding: 20px;
margin: 20px;
}
JavaScript
angular.module('app', ['ngSanitize']).controller('Ctrl', function($scope) {
$scope.stopFunc = function() {
$scope.stopFuncExec = true;
}
$scope.stopFuncExec == false;
$scope.myFunc1 = function() {
alert("Inside " + $scope.stopFuncExec);
var whoAreYou = "Coder";
if (whoAreYou == "Coder" && $scope.stopFuncExec == false) {
alert("Hello, stop me if you can!");
}
}
});