모바일 각도 UI를 사용하여 사이드 바를 열고 닫습니다. 이 사이드 바에서 사용자는 사람을 검색하여 배열에서 추가하거나 제거 할 수 있습니다.배열의 요소를 삭제할 때 사이드 바가 닫힙니다.
<li ng-repeat="recipient in persons.recipients">
<span class="wrapper">
<span class="imageWrap">
<span class="initials">
{{recipient.firstName.charAt(0)}}{{recipient.lastName.charAt(0)}} </span>
</span>
<a href="" class="trash" ng-click="removeRecipient($index);"><i class="fa fa-trash-o" aria-hidden="true"></i></a>
<span class="details">
<span class="info">
{{recipient.firstName}} {{recipient.lastName}}
<span class="persnr">{{recipient.employeeID}}</span>
</span>
</span>
</span>
</li>
위의 HTML 코드가 사이드에있는 지침에서이다 :
은 내가 <a ...></>
클릭 때 사이드 바을 닫 사람의 배열을 보여줍니다이 반복 있습니다.
$scope.removeRecipient = function(index) {
$scope.persons.recipients.splice(index,1);
}
기능 작동을하지만 사이드를 종료하고이 작업을 수행 이유를 알아낼 수 없습니다 : removeRecipient($index);
기능은 다음과 같습니다. 따라서 사용자가받는 사람을 제거 할 때마다 사이드 바를 다시 열어야합니다. 이 사이드 바를 어떻게 열어 두어야합니까?
참고 :
- 모바일 각도 UI : http://mobileangularui.com/docs/sidebars/
솔루션
내가 바로 removeRecipient($index);
기능 뒤에 ng-click
에서 $event.stopPropagation();
을 추가하여 내 문제를 해결했다.
사이드 바 'a'태그에 'ui-toggle'을 사용하고 있습니까? –
사이드 바 'a' 태그에서'ui-toggle '을 사용하지 않습니다. –