How to use $routeProvider.otherwise()?

时间:2015-07-13 21:09:19

标签: angularjs

I work on AngularJS project.

Here is module definition:

(function () {
    "use strict";
    var myApp = angular.module("DIMManagement", ["ngResource", "ngRoute"])
        .config(function ($routeProvider, $locationProvider) {
            $routeProvider.when('/DIM/Home', { templateUrl: '/app/DIM/DIMView.html', controller: 'DIMController' });
            $routeProvider.when('/DIM/Log', { templateUrl: '/app/Log/DIMLogView.html', controller: 'DIMLogController' });
            $routeProvider.otherwise ->?
            $locationProvider.html5Mode(true);
        });
}()); 

I want to use otherwise method of $routeProvider any idea how can I use it?

The intellisense of dose not give option to select otherwise method.

1 个答案:

答案 0 :(得分:0)

Just set the property as normal:

$routeProvider.otherwise({ redirectTo: '/' });

Depending on your IDE, I wouldn't really count on the intellisense for the most accurate help (just my opinion tho)