I have a modal that I would like shown when a URL parameter is specified (for example, url.com/?showmodal=1
. How can I call launchModalIfParameter
after the div has been rendered? Some extracts are included below.
Core.js
function getUrlParameter(sParam)
{
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++) {
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam) {
return sParameterName[1];
}
}
}
Widget.html (using Bootstrap's modal dialog)
<div class="modal fade" id="createSupportTicket" role="dialog" aria-hidden="true">
</div>
Widget.js
$scope.launchModalIfParameter = function () {
if ($('#createSupportTicket').length) {
alert('Found with Length');
}
if (getUrlParameter('ticket') == 1) {
$('#createSupportTicket').modal('show');
console.log("Shown activated");
}
}