Angular6 角度6:未定义alertify

Angular6 角度6:未定义alertify,angular6,alertify,Angular6,Alertify,我从“alertify”软件包中得到一个错误,说“alert未定义” 这是我代码的一部分 警报化服务: import { Injectable } from '@angular/core'; declare let alertify: any; @Injectable({ providedIn: 'root' }) export class AlertifyService { constructor() {} confirm(message: string, okCal

我从“alertify”软件包中得到一个错误,说“alert未定义”

这是我代码的一部分

警报化服务:

    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);
  }
angular.json:


注意:我已经在应用程序模块中添加了alertify服务。

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

确保您已经添加了

"./node_modules/alertifyjs/build/alertify.min.js"
到angular.json中的脚本数组