Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- mysql if
- 아이오닉 스크롤 이벤트
- route
- 앵귤러 모달
- modal
- ApexChart
- Oracle LISTAGG 사용 예시
- 옵저버블
- prisma
- 검색
- scroll
- angular route
- angular button
- Router
- flex-1
- Ionic modal
- TAILWIND
- angular modal
- 스크롤 이벤트 감지
- angular animation
- summary
- 스크롤 이벤트
- 앵귤러 애니메이션
- formgroup
- 셀렉트박스 커스텀
- 호버
- 모달
- ajax 사용 예시
- egov spring ajax 사용 예시
- Angular Router
Archives
- Today
- Total
깜놀하는 해므찌로
Angular modal data pass 예시 본문
반응형
SMALL
async deleteBranch() {
const modal = await this.modalController.create({
component: DeleteBranchModal,
componentProps: {
item: this.branch,
},
});
await modal.present();
modal.onDidDismiss().then((res) => {
if (res.role === 'submit') {
this.router.navigateByUrl(
this.router.routerState.snapshot.url.split('/')[1]
);
}
});
}
1. 모달 생성과 닫힌 후 로직
2. item : 통신 키 값
import { Component, OnInit, Input } from '@angular/core';
import { IonicModule } from '@ionic/angular';
import { ModalController } from '@ionic/angular';
import { ButtonComponent } from 'src/app/components/button/button.component';
import { Branch } from 'src/lib/branch';
import { CommonModule } from '@angular/common';
@Component({
selector: 'app-delete-branch',
templateUrl: './delete-branch.modal.html',
styleUrls: ['./delete-branch.modal.scss'],
standalone: true,
imports: [IonicModule, ButtonComponent, CommonModule],
})
export class DeleteBranchModal implements OnInit {
@Input() item!: Branch;
constructor(private modalController: ModalController) {}
ngOnInit() {}
dismiss() {
this.modalController.dismiss();
}
submit() {
this.modalController.dismiss(null, 'submit');
}
}
2. dismiss() : 두 번째 인자의 프로퍼티는 role 입니다. 따라서 위에서 role === 'submit' 비교가 가능합니다.
반응형
LIST
'IT' 카테고리의 다른 글
C언어 포인터 변수 활용 예시 (0) | 2023.05.01 |
---|---|
C언어 포인터 변수 기본 구조 설명 (0) | 2023.04.30 |
Angular 폰트 사이즈 변경 예시 / Angular 양방향 통신 예시 / sizeChage.emit / emit() (0) | 2023.04.29 |
Angular *ngFor constructor (0) | 2023.04.29 |
warning: in the working copy of 'yarn.lock', LF will be replaced by CRLF the next time Git touches it 에러 해결 예시 (0) | 2023.04.29 |