【问题标题】:How to put the action button when using the "snackBar.openFromComponent()" method in MatSnackBar?在 MatSnackBar 中使用“snackBar.openFromComponent()”方法时如何放置动作按钮?
【发布时间】:2019-05-25 18:48:57
【问题描述】:

我使用 MatSnackBar 进行通知,我想在小吃栏中有一个操作按钮。使用时如何插入 "snackBar.openFromComponent()" 方法?

这里是my code

【问题讨论】:

    标签: angular material-design angular-material2


    【解决方案1】:

    感谢this answer 我能够解决我的问题。

    这是一个working demo,添加了操作按钮。

    【讨论】:

    • 非常感谢这个简单的例子。我坚持的关键部分是将 snackBarRef 注入自定义组件的构造函数的必要性。
    【解决方案2】:

    您可以将操作按钮直接添加到您附加的 stackblitz 链接中的 snack-bar-component-example-snack.html。

    【讨论】:

      猜你喜欢
      • 2022-11-24
      • 1970-01-01
      • 2017-12-12
      • 2019-04-27
      • 1970-01-01
      • 1970-01-01
      • 2020-01-25
      • 2012-10-20
      • 2017-03-25
      相关资源
      最近更新 更多