Is there a way to trigger the modal pop-up by simply typing a URL link without the need for any click function? I am currently attempting to display the modal without requiring a login, but when I type the URL, the modal appears briefly and then disappears. Even if the user is logged in and has their email and password stored in local storage, the modal will only appear in that case. Is it possible to have the modal display even without a login or stored credentials?
reset.html
<div bsModal *ngIf="isModalShown" [config]="{ show: true }" #resetPwd="bs-modal" (onHidden)="onHidden()" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Reset Password</h4>
</div>
<div class="modal-body">
Modal body
</div>
</div>
</div>
</div>
reset.component.ts
import { Component, OnInit,ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { ModalDirective} from 'ngx-bootstrap';
@Component({
templateUrl: './reset.html'
})
export class ResetComponent {
constructor(public router: Router) {}
@ViewChild('resetPwd') public resetPwd:ModalDirective;
public isModalShown: boolean = true;
ngOnInit(){
this.showModal();
}
showModal(){
this.isModalShown = true;
this.router.navigate(['/reset']);
this.resetPwd.show();
console.log(this.isModalShown);
}
onHidden(){
this.isModalShown = false;
this.router.navigate(['/login']);
this.resetPwd.hide();
console.log(this.isModalShown);
}
}