Skip to content Skip to sidebar Skip to footer

How To Hide Angular-strap $alert

I have this code and on socket.connect I want to be able to hide the alert that was shown in socket.disconnect. I see there is a reference in the docs to $scope methods hide, show,

Solution 1:

I feel stupid today...

var alert = $alert({
    title: 'Connection lost.',
    content: 'Please reload the page.',
    placement: 'top-right',
    type: 'danger',
    show: false
});

socket.on('disconnect', function () {
    alert.show();
});

socket.on('connect', function () {
    alert.hide();
});

Post a Comment for "How To Hide Angular-strap $alert"