JSFiddle - React, Tailwind, and code Playground
HTML
<div>
<div ng-app="myApp" ng-controller="MyCtrl">
<my-directive animals="animals"></my-directive>
<pre> animals: {{ animals |json}} </pre>
</div>
</div>
JavaScript
angular.module("myApp", [])
.directive("myDirective", function () {
return {
restrict: 'EA',
replace: true,
scope: {
animals: '=animals'
},
template: '<div ng-repeat="group in animals">'+
'<span ng-repeat="animal in group">{{animal.id}}'+
'<input type="text" ng-model="animal.name"/>'+
'</span><hr>'+
'</div>'
}
});
function MyCtrl($scope) {
$scope.test = 'aaa';
$scope.animals = [
[{
id: 1,
name: 'cat',
size: 'small'
}, {
id: 2,
name: 'hippo',
size: 'medium'
}],
[{
id: 3,
name: 'elephant',
size: 'big'
}, {
id: 4,
name: 'camel',
size: 'medium'
}]
];
}