Last Updated: November 07, 2016
· MohamedSahir

Bootstrap alert message is not working inside angular run blocks under ui-router?

I am doing sample application to autologut if user is idle for 30 Min. before 1 minutes to logOut have to show an warning message to the user.

So i have calculated the minutes and show the warning messages in Bootstrap. But alert message is Not showing properly inside run. Javascript alert is working fine but Bootstrap alert is not working.

<!DOCTYPE html>
<html ng-app="app">

<link rel="stylesheet" href="">
<script src=""></script>
<script data-require="angular.js@1.4.0 " data-semver="1.4.0 " src=""></script>
<script src=""> </script>
<script src=""></script>

var app = angular.module('app', ['ui.router']); ($rootScope, $cacheFactory, $interval, $timeout) {

alert('1 more sec');

function load() {

    alert('you have 1 more sec to autoLogOut');
    $rootScope.showError = true;
    $rootScope.error = "helloo";
    $rootScope.errorMessage = 'you have 1 more sec to autoLogOut';
    $timeout(function () {
        $rootScope.doFade = true;
    }, 2500);

// Execute every time a state change begins
$rootScope.$on('$stateChangeStart', function (event, toState, toParams, fromState, fromParams, $rootScope) {






<div data-ng-show="showError" ng-class="{fade:doFade} " class="alert alert-danger ">


Bootstrap alert not showing under $stateChangestart.