Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use ALERTIFY JS (v1.9.0) in angular 2

I am trying to get AlertifyJS (v1.9.0) to work in my angular 2 app. I have the following in vendor.ts

import "alertifyjs/build/alertify.min.js";
import "alertifyjs/build/css/alertify.min.css";

with the following call to alertify

openConfirmationDialog(message: string, okCallback: () => any) {

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

but keep getting the error

: Cannot find name 'alertify'.
like image 256
Tee-Jay Avatar asked Mar 02 '17 18:03

Tee-Jay


1 Answers

OK folks, I got it working. it was as simple as just putting this line

var alertify = require('alertifyjs');

just immediately after my imports statements

like image 189
Tee-Jay Avatar answered Oct 09 '22 17:10

Tee-Jay