使用 Angular 更改对话框标题进行提醒
Alertify with Angular change dialog title
我已经在我的 Angular 8 项目中使用了 Alertify。现在我想更改调用 alertify.alert
时出现的对话框中的标题。文档说这可以通过使用接受标题的重载来完成:alertify.alert('Title', 'Message')
但是当我尝试使用它时 IDE 已经告诉我这是一个无效的参数数量并且在 运行 消息框仍然出现但未设置标题的时间。
这是怎么做到的?
编辑 1
版本:
- Angular: 7.3.8
- Alertifyjs: 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 确实在错误的行上工作了
我已经在我的 Angular 8 项目中使用了 Alertify。现在我想更改调用 alertify.alert
时出现的对话框中的标题。文档说这可以通过使用接受标题的重载来完成:alertify.alert('Title', 'Message')
但是当我尝试使用它时 IDE 已经告诉我这是一个无效的参数数量并且在 运行 消息框仍然出现但未设置标题的时间。
这是怎么做到的?
编辑 1
版本:
- Angular: 7.3.8
- Alertifyjs: 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 确实在错误的行上工作了