angularalertifyjs

Alertify with Angular change dialog title


I've got Alertify working in my Angular 8 Project. Now I wanted to change the title in the dialog box that appears when alertify.alert is invoked. The Documentation says this can be done by using the overload that accepts the title: alertify.alert('Title', 'Message') but when I try to use this the IDE already tells me that this is an invalid numbers of parameters and at run time the messages box still appears but the Title is not set.

How is this done?

Edit 1

Versions:

How I've integrated it:

In 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"
]

entries in styles.css

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

The service:

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

declare let alertify: any;

@Injectable({
  providedIn: 'root'
})

export class AlertifyService {

  constructor() {
  }

  error(message: string) {
    alertify.alert('MyApp', message);
  }
}

Solution

  • I've figured it out. The problem was the scripts entry:

    wrong:

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

    correct:

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

    Funny that alertify did work somehow with the wrong line