나는 * ngFor에서 오는이 스 니펫을 여러 번 생성합니다. 모든 프로파일은 고유 ID를 가지고 있는데이 버튼을 prees 때 나는 그것을 삭제할 :ng2-bs3-modal에 데이터를 전달하는 방법은 무엇입니까?
<a data-toggle="modal" data-target="#deleteProfile" (click)="deleteProfile.open()" role="button" style="color:red;"><i class="fa fa-trash-o" aria-hidden="true"></i> Delete</a>
html로 모달 : '예'버튼을 클릭하면
<modal #deleteProfile>
<modal-header [show-close]="true">
<h4 class="modal-title">Delete Profile</h4>
</modal-header>
<modal-body>
<div class="text-center">
Are you sure you want to delete this profile?
</div>
</modal-body>
<modal-footer>
<div class="control-group confirm-buttons">
<div class="row text-center">
<div class="col-md-6">
<button type="button" class="btn btn-cancel" data-dismiss="modal" (click)="closeDeleteProfile()">No</button>
</div>
<div class="col-md-6">
<button type="button" class="btn btn-confirm" (click)="deleteProfile()">Yes</button>
</div>
</div>
<div class="col-md-12 text-center">
<small>This is the footer</small>
</div>
</div>
</modal-footer>
</modal>
이
가 호출 :deleteProfile(id: string) {
this.modalDeleteProfile.dismiss();
this.profileService.delete(id)
.subscribe(
// data => console.log(data),
// error => console.log(error)
);
this.router.navigateByUrl('/dashboard');
}
프로필을 삭제하려면 위 코드에서 id를 얻으려면 어떻게해야합니까?
이
내가 사용하고 모달입니다 : 의견 영업 이익의 요청에 따라 https://github.com/dougludlow/ng2-bs3-modal
이것이 가능한지 전혀 알 수 없습니다. 같은 모달을 사용했습니다. 방금 추가 방법을 사용하자 방금 두 줄이되었습니다. 그래서 저는 성취하려는 것을 성취하려고 노력하지 않았습니다. 이 질문을 다음 tho 될 것입니다 :) – Alex
@ AJT_82 예제를 제공 할 수 있습니까? –
의 "추가 방법?" – Alex