私は自分のプロジェクトで alertify.js を使用しようとしています。ReferenceError: alertify is not defined
しかし、アプリケーションでボタンをクリックするとエラーが発生しました。
alertifyjs css および js ファイルをangular.jsonファイルに追加します。
alertify.service.ts
私の間違いを特定するのを手伝ってください。
編集
私はalertifyServiceをcomponent.tsファイルにインポートしprivate alertify: AlertifyService
、アプリモジュール にインポートimport { AlertifyService } from './services/alertify.service';
し、プロバイダーにAlertifyServiceを追加しました providers: [AlertifyService]
ログインコンポーネントでアラートを使用しています
login.component.ts
login(){
let email = this.loginForm.get("email").value;
let password = this.loginForm.get("password").value;
this.loading = true;
this.authService.login(email, password).subscribe(response => {
this.alertify.success('Successfully Login');
this.loading = false;
// Save data to sessionStorage
localStorage.setItem('isLoggedIn', "true");
localStorage.setItem('currentUserID', response.user.uid);
this.router.navigate(['/dashboard'])
}, error => {
this.loading = false;
});
}