使用"角度更改"对话框标题发出警报



我的Angular 8项目中有Alertify。现在,我想更改调用alertify.alert时出现的对话框中的标题。文档中说,这可以通过使用接受标题alertify.alert('Title', 'Message')的重载来完成,但当我尝试使用它时,IDE已经告诉我这是无效的参数数量,并且在运行时,消息框仍然显示,但标题没有设置。

这是怎么做到的?

编辑1

版本:

  • 角度:7.3.8
  • Alertiyjs:1.12.0

我是如何集成它的:

angular.json

"styles": [
"./node_modules/bootstrap/dist/css/bootstrap.min.css",
"./node_modules/ngx-bootstrap/datepicker/bs-datepicker.css",
"src/styles.css"
],
"scripts": [
"node_modules/alertifyjs/build/alertify.min.js"
]

styles.css中的条目

@import "../node_modules/alertifyjs/build/css/alertify.min.css";
@import "../node_modules/alertifyjs/build/css/themes/bootstrap.min.css";

服务:

Import {Injectable} from '@angular/core';
declare let alertify: any;
@Injectable({
providedIn: 'root'
})
export class AlertifyService {
constructor() {
}
error(message: string) {
alertify.alert('MyApp', message);
}
}

我已经想通了。问题是脚本条目:

错误:

"scripts": [
"node_modules/alertifyjs/build/alertify.min.js"
]

正确:

"scripts": [
"./node_modules/alertifyjs/build/alertify.min.js"
]

有趣的是,alertify确实以某种方式使用了错误的线路

最新更新