JSFiddle - React, Tailwind, and code Playground
by foreyez
HTML
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.28/angular.min.js"></script>
<div ng-app="myApp">
<div ng-controller='ParentCtrl'>
<div style='width:240px;height:80px;' class="test" bind-var="sels">
</div>
</div>
</div>
CSS
.item {
background:#eee;
border:1px solid black;
display: inline-block;
text-align:center;
}
JavaScript
var myApp = angular.module('myApp', []);
myApp.directive("test", function () {
return {
restrict: 'C',
scope: {
bindVar: '='
},
template: '<div>\
<div class="item" ng-repeat="sel in bindVar">{{sel.display}}</div>\
</div>',
link: function ($scope, element, attrs) {
// setTimeout(function() {
alert($('.item').length);
// },0);
} // of link
} // of return
});
function ParentCtrl($scope){
$scope.foo= false;
$scope.sels= [{display:'hi'},{display:'hi2', selected:true},{display:'hi3'}];
}