Reputation: 164
I am getting an error saying "alert is not defined" from the "alertify" package.
This is part of my code.
alertifyservice:
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:
Note: I've already added alertify service in app module .
Upvotes: 0
Views: 1670
Reputation: 3034
By the look of it you have only added the stylesheets. You are missing the javascript for alertifyjs.
Make sure you have added
"./node_modules/alertifyjs/build/alertify.min.js"
to your scripts array in angular.json
Upvotes: 1