一个通知模块
    需要在全局style.css中加上@import "angular-notifier/styles";
    再在component中引入

    1. private readonly notifier: NotifierService;
    2. constructor(
    3. notifierService: NotifierService
    4. ) {
    5. this.notifier = notifierService;
    6. }

    还需要在全局引入

    1. <router-outlet>
    2. <notifier-container></notifier-container>
    3. </router-outlet>
    1. import {NotifierModule, NotifierOptions} from "angular-notifier";
    2. const customNotifierOptions: NotifierOptions = {
    3. position: {
    4. horizontal: {
    5. position: 'left',
    6. distance: 12
    7. },
    8. vertical: {
    9. position: 'bottom',
    10. distance: 12,
    11. gap: 10
    12. }
    13. },
    14. theme: 'material',
    15. behaviour: {
    16. autoHide: 5000,
    17. onClick: 'hide',
    18. onMouseover: 'pauseAutoHide',
    19. showDismissButton: true,
    20. stacking: 4
    21. },
    22. animations: {
    23. enabled: true,
    24. show: {
    25. preset: 'slide',
    26. speed: 300,
    27. easing: 'ease'
    28. },
    29. hide: {
    30. preset: 'fade',
    31. speed: 300,
    32. easing: 'ease',
    33. offset: 50
    34. },
    35. shift: {
    36. speed: 300,
    37. easing: 'ease'
    38. },
    39. overlap: 150
    40. }
    41. };
    42. @NgModule({
    43. imports: [
    44. NotifierModule.withConfig(customNotifierOptions) // 通知功能
    45. ]
    46. })

    更多内容在StackBlitz