I am trying to define a default route when angularjs hits the below url
The default route should go to home page below.
How can I define it using $urlRouterProvider ? The below line does not seem to be making any difference.
$urlRouterProvider.otherwise('/');
Any suggestions? Thank you!
appl.config(['$stateProvider', '$urlMatcherFactoryProvider', '$locationProvider', '$urlRouterProvider',
function ($stateProvider, $urlMatcherFactoryProvider, $locationProvider, $urlRouterProvider) {
$urlMatcherFactoryProvider.caseInsensitive(true);
$stateProvider
.state('home', {
url: '',
templateUrl: 'search',
controller: 'applCtrl'
})
.state('person', {
url: '/person',
templateUrl: 'Person',
controller: 'applPersonCtrl'
})
$urlRouterProvider.otherwise('/');
$locationProvider.hashPrefix(''); //it defaults to ! after angularjs 1.5
}]);
<base href="/">inside your<head></head>element in index.html and then add$locationProvider.html5Mode(true);just above where you're callinghashPrefix('')?