Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActionableNotification close button action. #2724

Open
placzkowskim opened this issue Oct 25, 2023 · 3 comments · May be fixed by #2727
Open

ActionableNotification close button action. #2724

placzkowskim opened this issue Oct 25, 2023 · 3 comments · May be fixed by #2727

Comments

@placzkowskim
Copy link

ActionableNotification close button action.

Hi I have created actionable notification like:

<cds-actionable-notification [notificationObj]="{ inline: true, type: 'error', title: 'Error: Unable to procees your request this time.', actionsTemplate: customActionableTrigger, message: 'Please try again later', showClose:true, lowContrast: true, }" (close)="onNotificationClose()" > </cds-actionable-notification>

I need such default behaviour as close that component on 'x' click.
My onNotificationClose() method is beeing properly invoked on 'x' click.
How can I achieve it ?
Should I somehow register notification component created in template in NotificationService ?
NotificationDisplayService exposes close() method but it accepts ComponentRef. Does this mean that I should create that notification using ComponentResolverFactory ? Or there is some simple solution that I'm missing.

@nipun005
Copy link

Hi @placzkowskim, To implement such functionality- When the user will click on close icon of the actionable notification, Then your method which you written should invoke, Fix is required in actionable-notification file.
Please assign this issue to me, I will fix it and would raise PR.

nipun005 added a commit to nipun005/carbon-components-angular that referenced this issue Oct 27, 2023
@nipun005
Copy link

Hi @placzkowskim, Below PR has been raised for above issue.
#2727

After merging of this PR, On Click of X button of ActionableNotification, "onNotificationClose()" method will automaticaaly be invoked if you check with above code again that you used previously, and you would not be needed to use any other approach like- ComponentResolverFactory or something.

@Akshat55
Copy link
Contributor

Akshat55 commented Feb 1, 2024

Hi, if you would like to close the notification. I highly recommend using the notification service to dynamically render your component. The component will be dynamically removed on x click. We have quite a few examples of this in our storybook:

https://angular.carbondesignsystem.com/?path=/story/components-notification--dynamic-inline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants