JSFiddle - React, Tailwind, and code Playground

by Brett DeWoody

HTML

<div ng-app="miniapp">
    <div ng-controller="Ctrl">
        <a ng-click="clickEvent($event)" class="exampleClass" id="exampleID" data="exampleData" 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.data.value);
        
    }
};