I'm trying to pass my
ng-repeat
iso-lated scope
Demo Fiddle about what I'm trying
<div ng-app="my-app" ng-controller="MainController">
<div ng-repeat="document in documents">
<name-row
document-element="document">
</name-row>
</div>
</div>
module.directive('nameRow', function() {
return {
restrict: 'E',
replace: true,
scope: {
documentElement : '=document',
},
controller: function($scope) {
console.log($scope.documentElement);
},
template:
' <ul>' +
' <li>' +
' <a>' +
' {{documentElement.targetPrice}}' +
' </a>' +
' </li>' +
' </ul>'
};
});
You used alias for attribute =document
, You attribute should be document
instead of document-element
.
<div ng-repeat="document in documents">
<name-row
document="document">
</name-row>
</div>
Other way would be you could remove an alias of attribute in isolated property declaration.
scope: {
documentElement : '=', //just have `=` instead of `=document`
},