question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use the notification over modal popup

See original GitHub issue

As per the steps mentioned in the notification example, I had set up it in my app component <simple-notifications [options]="notificationOptions" (onCreate)="onNotificationsCreate($event)" (onDestroy)="onNotificationsDestroy($event)" class="mm-alerts-popup"></simple-notifications>

Now it is showing the notification all over the places wherever it is required. Issue is I have specific page which has a form filling popup (modal) If i want to validate the data i am calling the notification service and showing the message. But as the “simple-notifications” component is at app level, it is showing below the popup/Modal. How i can achieve this? so that at this point i can show this over popup not at below of it.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
ahmed-hamdy90commented, Oct 2, 2020

At First: I tried use solution [which suggested by @flauc -> Here ] for change z-index style, It works with me, I must override z-index of modal background overlay with values less than notification layout plus use ViewEncapsulation.None under Component like this:

Style file:

ngb-modal-backdrop.modal-backdrop {
  z-index: 9000 !important;
}

.my-modal {
  z-index: 9100 !important;
}

div.simple-notification-wrapper {
    z-index: 9999 !important;
}

Component class:

@Component({
  selector: 'app-my-modal',
  templateUrl: './my-modal.component.html',
  styleUrls: ['./my-modal.component.css'],
  encapsulation: ViewEncapsulation.None
})
export class MyModalComponent implements OnInit {}

But This solution may be bug in case there two pop-up modal into same page (one which override it’s z-index and another with default Bootstrap Modal style), Scenario for Bug: when open First The override Modal style then Open The modal with default Style Will display Background overlay above model view as we use ViewEncapsulation.None into Component class.

Then: I tried use another solution [which suggested by @JanvanCasteren -> Here ] of put <simple-notification> tag with-in Modal view without any style override, it work with me Even this solution was settings duplicate <simple-notification> tag as the main one setting under app.Component class’s view.(There no duplicate notifications will display)

Finally: I hope this issue will be solved using Library’s Options without need to try any workaround before 2021

1reaction
JanvanCasterencommented, Jul 17, 2020

I have <simple-notifications [options]=“notificationOptions”></simple-notifications> included in my appComponents html.

Like @deepender87 states, when using a popup dialog, the notification popups appear behind the dialog.

My solution was to simple add a second simple-notifications element inside the dialogs content section.

In my case (I use primeng dialogs):

<p-dialog  ....>
   <!-- all html between <p-dialog  ....> and </p-dialog> will be shown as dialog content -->
   <div>this is dialog content</div>
  <simple-notifications [options]="notificationOptions"></simple-notifications><!-- this notification will show render above the dialog -->
</p-dialog>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Alert over Modal - Stack Overflow
You can try putting the alert code in a div inside the modal div itself and keep it hidden and then trigger the...
Read more >
How to create alert notifications and modals - Documentation
The concrete notifications use PNotify.js and can be created using the ConcreteAlert ... <?php echo json_encode(t('My dialog modal message.
Read more >
What is a Popup Notification? Slider, Modal, Embedded
Modals notifications grasp the attention of the user. They notify them of an error or a state requiring immediate action. They compel the...
Read more >
Bootstrap Popup - free examples, templates & tutorial
Responsive Popup built with Bootstrap 5. Examples include modal popup, popup box, notification message popup, alert popup, lightbox popup & popup form.
Read more >
Modal - Bootstrap
Clicking on the modal “backdrop” will automatically close the modal. Bootstrap only supports one modal window at a time. Nested modals aren't supported...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found