I want to slide toggle closest .contactDetails when a is clicked. Below is my code which does not work.
<ul>
<li ng-repeat="detail in details">
<div>
<a show-contact>{{something}}</a>
<div class="contactDetails">
<ul>
<li ng-repeat="another ng-repeat">
<b>{{something}}</b>
</li>
</ul>
</div>
<br>
</div>
</li>
</ul>
app.directive("showContact", function () {
return {
restrict: "A",
link: function (scope, element) {
element.click(function () {
element.find(".contactDetails").slideToggle();
});
}
};
});
I think AngularJS cannot find the closest .contactDetails somehow so slideToggle() cannot be performed.
I tried but element.closest(".contactDetails") did not work either. Thanks for your help.