JSFiddle - React, Tailwind, and code Playground
by jannis
HTML
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.0.1/angular.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<div ng-controller="DemoCtrl">
<a ng-repeat="id in ids" href="#" data-content-id="{{id}}" my-dir="{{id}}">{{id}}</a>
</div>
</body>
</html>
JavaScript
'use strict';
angular.module('myApp', [])
.directive('myDir', function() {
return {
compile: function compile(scope, tElement, tAttrs) {
return {
post: function postLink(scope, iElement, iAttrs) {
console.log("scope, iElement, iAttrs", scope, iElement, iAttrs);
console.log("The full iAttrs object: ", iAttrs);
console.log("My elements content id is = ", iAttrs.contentId);
}
};
}
};
});
function DemoCtrl($scope) {
$scope.ids = ["T29", "T28"];
};