Skip to content

Instantly share code, notes, and snippets.

@brianpetro
Created August 18, 2016 17:02
Show Gist options
  • Save brianpetro/558755b8538905c7425157107066ec98 to your computer and use it in GitHub Desktop.
Save brianpetro/558755b8538905c7425157107066ec98 to your computer and use it in GitHub Desktop.
<body>
<div ng-app="myApp">
<div ng-controller="ctrl1">
<button ng-click="showAlert($event)">Show Alert</button>
</div>
</div>
<script>
angular.module('myApp', [])
.controller('ctrl1', function ($scope) {
$scope.name = "John Smith1";
$scope.showAlert = function ($event) {
var btnText = $event.target.innerText;
alert(btnText);
}
});
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment