Angular 1.1.5: Empty Fiddle
http://angularjs.org/
by skeemer
HTML
<script src="http://code.angularjs.org/1.1.5/angular.js"></script>
<div ng-controller="MyCtrl">
<div ng-repeat="item in list" row>{{item}}</div>
</div>
CSS
div[row] {
color: red;
}
JavaScript
var myApp = angular.module('myApp', []);
//myApp.directive('myDirective', function() {});
//myApp.factory('myService', function() {});
function MyCtrl($scope) {
$scope.name = 'Superhero';
$scope.list = [
'alpha',
'apple',
'charlie',
'clouset',
'don',
'fred',
'pan',
'pat'];
}
myApp.directive('row', function ($compile) {
return {
restrict: 'A',
link: function (scope, element, attrs) {
console.log(scope);
element[0].outerHTML = '<div>{{item}}</div>';
$compile(element.contents())(scope);
}
}
});