Actions Confirmation
Edit on GitHubActions Confirmation is an angular Service in the components library that calls another action with a confirmation via the Modal component.
Usage
Service configuration:
ATTRIBUTE | DESCRIPTION |
---|---|
type |
An action type. |
action |
Registered action configuration. |
modal |
Modal configuration based on the ConfirmModalStrategyOptions interface of the Modal component. |
Usage example:
<spy-button-action
[action]="{
type: 'confirmation',
action: {
type: 'redirect',
url: '/url',
},
modal: {
description: 'Redirect to /url',
},
}"
>
</spy-button-action>
Service registration
Register the service:
declare module '@spryker/actions' {
interface ActionsRegistry {
confirmation: ConfirmationActionHandlerService,
}
}
@NgModule({
imports: [
ActionsModule.withActions({
confirmation: ConfirmationActionHandlerService,
}),
],
})
export class RootModule {}
Interfaces
Actions Confirmation interfaces:
export interface ConfirmationActionConfig extends ActionConfig {
action: ActionConfig;
modal?: ConfirmModalStrategyOptions;
}
export interface ConfirmModalStrategyOptions extends ConfirmModalData {}
export interface ConfirmModalData {
title?: string | TemplateRef<ModalTemplateContext<AnyModal>>;
description?: string | TemplateRef<ModalTemplateContext<AnyModal>>;
icon?: string | TemplateRef<ModalTemplateContext<AnyModal>>;
okText?: string | TemplateRef<ModalTemplateContext<AnyModal>>;
okType?: string;
okVariant?: ButtonVariant;
okSize?: ButtonSize;
cancelText?: string | TemplateRef<ModalTemplateContext<AnyModal>>;
cancelType?: string;
cancelVariant?: ButtonVariant;
cancelSize?: ButtonSize;
class?: string;
}
Thank you!
For submitting the form