我想在“link”属性中访问“num”。但我不能只是这样做value={{num}}
。这样做的正确方法是什么?
HTML
<div class="customDirective" ng-repeat="num in [1,2,3]"></div>
指示
function customDirective(loggedUserService) {
return{
restrict: "C",
link: function (scope, element, attrs) {
//I would like to access num
},
template: "<div>some stuff</div>"
};
}
app = angular
.module('myApp', [])
.directive('customDirective', customDirective)