src/modal/base-modal.class.ts
Extend BaseModal in your custom modal implementations to ensure consistent close behavior.
ModalService depends on the close event to correctly clean up the component.
| Selector | [cdsBaseModal], [ibmBaseModal] |
Methods |
Inputs |
Outputs |
| open | |
Type : boolean
|
|
Default value : false
|
|
|
Defined in src/modal/base-modal.class.ts:25
|
|
|
Controls the open state of the modal |
|
| close | |
Type : EventEmitter
|
|
|
Defined in src/modal/base-modal.class.ts:20
|
|
|
Base event emitter to propagate close events |
|
| closeModal |
closeModal()
|
|
Defined in src/modal/base-modal.class.ts:30
|
|
Default method to handle closing the modal
Returns :
void
|
import {
Output,
EventEmitter,
Input,
Directive
} from "@angular/core";
/**
* Extend `BaseModal` in your custom modal implementations to ensure consistent close behavior.
*
* `ModalService` depends on the `close` event to correctly clean up the component.
*/
@Directive({
selector: "[cdsBaseModal], [ibmBaseModal]"
})
export class BaseModal {
/**
* Base event emitter to propagate close events
*/
@Output() close = new EventEmitter();
/**
* Controls the open state of the modal
*/
@Input() open = false;
/**
* Default method to handle closing the modal
*/
closeModal(): void {
this.close.emit();
}
}