I am working on an application using vuejs. When a user logins to my application, i would like to show an error (if any) using bootstrap modal instead of the old fashion alert. Is there a way to "pop" the modal from javascript without the use of jQuery?
Thank you :)
$("#loginerror").modal();
The code above uses jQuery but I do not want to use that.
I have tried using the ref method but it shows an error saying this.$refs.loginerror.modal is not a function
Below is my code for the ref method:
<!-- Modal -->
<div ref="loginerror" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Login Error</h4>
</div>
<div class="modal-body">
<p id = "loginerrormsg"></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
snippets of Javascript code
.catch((error) => {
document.getElementById("loginerrormsg").innerHTML = error;
this.$refs.loginerror.modal();
});