I have the following Angular custom directive code:
Template (ReviewStandards.html)
<div class="review-standard" ng-repeat="standard in standards">
<button ng-click="mark(standard)">Mark Complete</button>
</div>
JS
app.directive("reviewStandards", function ($parse, $state) {
return {
restrict: "A",
templateUrl: function (elements, attrs) {
return "/Scripts/App/Directives/Templates/ReviewStandards.html";
},
transclude: false,
scope: {
standards: "="
},
replace: true,
link: function (scope, elem, attrs) {
scope.mark = function (standard) {
alert();
};
}
};
});
The directive is used as:
<div review-standards standards="review.ReviewStandards"></div>
Where standards is just a JSON array of standard objects.
Problem is that the the ng-click is not firing the function when the button is clicked. The scope is isolated - is this something to do with this or the fact that the button is in an ng-repeat?
<div review-standards standards="review.ReviewStandards"></div>related to the rest of the question?