0

As I said in my other question, I'm creating a webapp in AngularJS with NodeJS, Express and Angular-UI-Router.

At first I couldn't get the page to load at all (I managed to solve that problem), now the issue is that Angular-UI-Router doesn't seem to be able to go to nested states.

Note that this is a problem only on Internet Explorer. The website works perfectly on Chrome and Firefox. I'm using Internet Explorer 11.

"Regular" states work fine, but I can't access nested states (it doesn't throw any error though)

May it be because I use HTML5 no-hash URLs?

This is my index:

<!DOCTYPE html>
<html>
    <head>
        <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
        <!-- Angular Material CSS now available via Google CDN; version 1.0.7 used here -->
        <link rel="stylesheet" href="./modules/angular-material/angular-material.min.css"/>
        <link rel="stylesheet" href="./css/style.css"/>
        <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"/>
    <link rel="icon" href="icons/favicon.ico" type="image/x-icon"/>
        <base href="/"/>
        <title>Area Clienti</title>
        <script src="./modules/angular/angular.js" type="text/javascript"></script>

        <script src="./modules/ngstorage/ngStorage.js" type="text/javascript"></script>

        <script src="./modules/angular-aria/angular-aria.min.js" type="text/javascript"></script>
        <script src="./modules/angular-animate/angular-animate.min.js" type="text/javascript"></script>

        <script src="./modules/angular-material/angular-material.min.js" type="text/javascript"></script>

        <script src="./modules/angular-ui-router/release/angular-ui-router.min.js" type="text/javascript"></script>
        <script src="./modules/ui-router-extras/release/modular/ct-ui-router-extras.core.min.js" type="text/javascript"></script>
        <script src="./modules/ui-router-extras/release/modular/ct-ui-router-extras.dsr.min.js" type="text/javascript"></script>
        <script src="./modules/ui-router-extras/release/modular/ct-ui-router-extras.sticky.min.js" type="text/javascript"></script>

        <script src="./modules/pdfmake/build/pdfmake.min.js" type="text/javascript"></script>
        <script src="./modules/pdfmake/build/vfs_fonts.js" type="text/javascript"></script>

        <script src="./modules/angular-messages/angular-messages.min.js" type="text/javascript"></script>
        <script src="http://ngmaterial.assets.s3.amazonaws.com/svg-assets-cache.js" type="text/javascript"></script>

        <script src="./js/client.js" type="text/javascript"></script>
    </head>
    <body ng-app="App" ng-controller="AppCtrl" ng-view ui-view ng-cloak layout="row">
    </body>
</html>

This is the js config for ui-router states:

app.config(function($locationProvider, $mdThemingProvider, $mdIconProvider,$stateProvider, $urlRouterProvider, $stickyStateProvider) {
        $locationProvider.html5Mode(true);

        $mdThemingProvider
            .theme('default')
            .primaryPalette('blue')
            .accentPalette('light-blue');

        $urlRouterProvider.otherwise('/login');

        //$stickyStateProvider.enableDebug(true);

        $stateProvider
            .state('login', {
                url: '/login',
                templateUrl: 'views/login.html',
                controller:'loginController',
                authenticate: false
            })
            .state('dashboard', {
                url: '/',
                templateUrl: 'views/dashboard.html',
                controller:'dashboardController',
                authenticate: true,
                sticky:true,
                dsr:true
            })
            .state('dashboard.rating', {
                url:'rating',
                templateUrl: 'views/rating.html',
                controller: 'ratingController',
                authenticate: true,
                abstract:true
            })
            .state('dashboard.rating.search', {
                url:'/search',
                views: {
                    'top': {
                        templateUrl: 'views/rating-search.html'
                    },
                    'content':{
                        templateUrl:'views/rating-search-result.html'
                    }
                },
                authenticate: true
            })
            .state('dashboard.rating.view', {
                url:'/view',
                views: {
                    'top': {
                        template: ''
                    },
                    'content':{
                        templateUrl:'views/rating-view.html'
                    }
                },
                authenticate: true
            })
            .state('dashboard.infocamere', {
                url:'infocamere',
                templateUrl: 'views/in-costruzione.html',
                authenticate: true
            })
            .state('dashboard.pratiche', {
                url:'pratiche',
                templateUrl: 'views/in-costruzione.html',
                authenticate: true
            });
    })
Community
  • 1
  • 1
Hankrecords
  • 344
  • 5
  • 18

1 Answers1

1

Add this in meta tag

 <meta http-equiv="X-UA-Compatible" content="IE=edge">

This can be considered equivalent to HTML5 doc-type which asks the browser to run in the doc in most supported mode from IE 11 to IE 6 Edge is the most supported document mode in IE

For more information about this one can read this thread https://github.com/google/web-starter-kit/issues/728

Vinod Louis
  • 4,812
  • 1
  • 25
  • 46
  • I noticed a problem though: this only works if I use IE11 in Edge mode, if I select IE10 or previous versions in the developer console, sub states break again. Is there a way of making it work on IE8, 9 and 10? – Hankrecords Feb 07 '17 at 08:04
  • Is Doctype defined on index page ? try replacing edge by 8,9,10 – Vinod Louis Feb 07 '17 at 08:05
  • Yes, the DOCTYPE is defined, I tried replacing it with 8, 9, 10 and EmulateIE10, but it didn't help – Hankrecords Feb 07 '17 at 08:17
  • Is it the routing problem or other also have you gone through this https://docs.angularjs.org/guide/ie ? – Vinod Louis Feb 07 '17 at 08:20
  • Yep, I've gone through the steps described in that article. I think it may be a routing problem, since the two basic states (dashboard and login) work but not the nested states, but it's weird that it only happens on IE. It might be an issue with Angular altogether though, since the Angular Material input textbox I have do not work even on Edge mode. – Hankrecords Feb 07 '17 at 08:43
  • Also, I don't know if it's relevant or not, but IE developer console shows absolutely nothing in the DOM explorer, even when the states work. – Hankrecords Feb 07 '17 at 09:10