angularjs routeprovider otherwise not working second time

I have the following code

'use strict';

var app = angular.module('myapp', ['ngRoute']);

app.config(['$routeProvider', function($routeProvider) {
        $routeProvider.when('/alljobs',{templateUrl:'alljobs.html', controller:'alljobsController'});
        $routeProvider.when('/myjobs',{templateUrl:'myjobs.html', controller:'myjobsController'});
        $routeProvider.when('/reports',{templateUrl:'reports.html', controller:'reportsController'});
        $routeProvider.when('/history',{templateUrl:'history.html', controller:'historyController'});
        $routeProvider.otherwise({redirectTo: '/alljobs'});
    }
]);

When I try to access the url "mysitelocation#/asdf" (or any text apart from the registered routes) while i am on any of the routes (/myjobs, /history, /reports or /alljobs) for the first time it redirects me to "/alljobs" as expected. But when i use the same garbage route ('mysitelocation#/asdf' in this case) the second time it just does nothing. It does not try to open a partial but it neither redirects me to "/alljobs".

I am checking on Internet Explorer 9.

Answers


I just found a working solution to this for my software. I would need to look at your html, but in mine I had to add class="ng-app:myapp" to the html tag

Found it here: Why does ng-class="ng-app" break AngularJS?


Need Your Help

OOP - Handling Automated Instances of a Class - PHP

php oop class instantiation

This is a topic that, as a beginner to PHP and programming, sort of perplexes me. I'm building a stockmarket website and want users to add their own stocks. I can clearly see the benefit of havin...

Authorizing with oAuth, posting to Twitter

php curl twitter twitter-oauth

I've created a Twitter Application to auto-post to my Twitter account. So, I don't need to authorize new users.