【问题标题】:Server-side triggered toast in MeteorMeteor 中的服务器端触发吐司
【发布时间】:2016-02-17 07:31:22
【问题描述】:

我有一个案例,很少有用户在使用 angular-meteor 的 Meteor 应用程序的页面(ui-router 状态)上。我想让toast 在每次用户执行操作时为所有用户显示,这是对集合的更新。

我想为此我应该在集合更新的那一刻从服务器触发 toast,但由于它是 CSS 和客户端的东西,我不知道该怎么做。

有没有办法在集合上实现一些侦听器,并通过 toast 向当前处于特定状态(页面)的所有用户通知它何时更新?

【问题讨论】:

    标签: javascript angularjs meteor materialize angular-meteor


    【解决方案1】:

    您必须创建一个通知集合,为每个用户的每个操作插入一个通知。您还需要一个仅订阅当前用户通知的通知发布/订阅。然后,在您的模板助手中:

    notifications() {
        var notification = Notifications.findOne();
        if( notification ) {
          // Execute a modal popup or something - make sure to pass the current value.
          // Call a meteor method to remove the notification.
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-12-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-17
      相关资源
      最近更新 更多