JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-app="miniapp">
<div ng-controller="Ctrl">
<a ng-click="clickEvent($event)" class="exampleClass" id="exampleID" data="exampleData" dataitemtest="exampleData1" href="">Click Me</a>
</div>
</div>
CSS
a.starOn {
color:green;
}
a.starOff {
color:red;
}
JavaScript
var $scope;
var app = angular.module('miniapp', []);
function Ctrl($scope) {
$scope.clickEvent = function(obj) {
// Log the obj to see everything
console.log(obj);
// Alert just the data value
alert(obj.target.attributes.dataitemtest.value);
}
};