0

我从“alertify”包中​​收到“未定义警报”的错误消息。

这是我的代码的一部分。

提醒服务:

    import { Injectable } from '@angular/core';

declare let alertify: any;

@Injectable({
  providedIn: 'root'
})
export class AlertifyService {
  constructor() {}

  confirm(message: string, okCallback: () => any) {
    alertify.confirm(message, function(e) {
      if (e) {
        okCallback();
      } else {
      }
    });
  }
  success(message: string) {
    alertify.success(message);
  }

角.json:

在此处输入图像描述

注意:我已经在 app module 中添加了 alertify 服务。

4

1 回答 1

1

从外观上看,您只添加了样式表。您缺少 alertifyjs 的 javascript。

确保您已添加

"./node_modules/alertifyjs/build/alertify.min.js"

到 angular.json 中的脚本数组

于 2019-03-18T20:17:54.813 回答