I have created an application using angularJS framework. While running application on web browser, i am gettting # along with my url. I tried the following below,
var app = angular.module('missingFound', ['ngRoute','ngCookies','UserModel','homeController','DashBoardContrl','TimeLineContrl','MissingPostContrl','FoundPostContrl','GisContrl'])
.config(['$routeProvider','$locationProvider',
function($routeProvider,$locationProvider) {
$routeProvider.when('/', {
templateUrl : 'views/home.html',
controller : 'homeCtrl'
})
.when('/dashboard',{
templateUrl: 'views/dashboard.html',
controller : 'dashboardCntr',
authenticated : true
})
.when('/timeline',{
templateUrl : 'views/timeline.html',
controller : 'timelineCntr',
authenticated : true
})
.when('/missingForm',{
templateUrl : 'views/missingForm.html',
controller : 'missingCntr',
authenticated : true
})
.when('/foundForm',{
templateUrl : 'views/foundForm.html',
controller : 'foundCntr',
authenticated : true
})
.when('/gisPage',{
templateUrl : 'views/gis.html',
authenticated : true
})
.otherwise({
redirectTo:"/"
});
$locationProvider.html5Mode(true);
/* $locationProvider.html5Mode({
enabled: true,
requireBase: false
});*/
}])
.run(['$rootScope','$location','AuthService',
function($rootScope,$location,AuthService){
$rootScope.$on("$routeChangeStart", function(event, next, current){
if(next.$$route.authenticated){
if(!AuthService.getAuthStatus()){
$location.path('/');
}
}
if(next.$$route.originalPath == '/'){
console.log('Login Page');
if(AuthService.getAuthStatus()){
$location.path(current.$$route.originalPath);
}
}
})
}]);
My URL is looking like this - http://localhost:7080/Police4/#/
Its working fine after login when i am navigating to different hmtl page via routing but when i am trying to copy the URL path and opening in differnt tab its showing page not found. Before with '#' it is working fine, but URL is looking ugly.