JSFiddle - React, Tailwind, and code Playground

by marco_m_alves

HTML

<div ng-controller="Ctrl">
    <list2 entries="entries">{{$index}} Hello {{entry}}</list2>
</div>

JavaScript

var app = angular.module('app', []);

app.directive('list2', function() {
    return {
        restrict: 'E',
        transclude: true,
        replace: true,
        scope: {
            entries: '='
        },
        template: '<table>' + '<tr ng-repeat="entry in entries | filter: \'o\'">' + '<td ng-click="click($index)"><div ng-transclude></div></td>' + '</tr>' + '</table>',
        controller: function($scope) {
            $scope.click = function(index) {
                console.log(index);
            }
        }
    };
});

app.controller('Ctrl', function($scope) {
    $scope.entries = ['Marco', 'Jorge', 'Manteigas', 'Lima', 'Alves'];
});