Angular UI-Router Not Resolving with Internet Explorer 9 Angular UI-Router Not Resolving with Internet Explorer 9 angularjs angularjs

Angular UI-Router Not Resolving with Internet Explorer 9


We use something like the following:

<!DOCTYPE html>  <html lang="fr" xmlns="http://www.w3.org/1999/xhtml" ng-csp xml:lang="fr-CA">//...var app = angular.module('YourApp', [...]);angular.bootstrap(document, ['YourApp'], {strictDi: true})//...    angular.module('YourApp').config(['$stateProvider', '$urlRouterProvider', '$locationProvider',  function ($stateProvider, $urlRouterProvider, $locationProvider) {    $locationProvider.html5Mode(false);    $locationProvider.hashPrefix('!');    $urlRouterProvider.otherwise('/');    $stateProvider      .state('home', {        url: '/',        cache: false,        controller: 'HomeController as vm'      })      .state('anon', {        url: '/info',        controller: 'AnonController as vm'      })

//etc...


For me, IE9 routes correctly for hash urls, /#/example, but visiting / would resolve to the otherwise route. I worked around this by using a function for otherwise, and checking the url in it.

$urlRouterProvider.otherwise(function($injector){    var state = $injector.get('$state');    var location = $injector.get('$location');    if (!location.url()) {        // handle HTML5 fallback / IE9 when url has no hash        return state.go('home');    }    state.go('404');});