Reputation: 3560
Hi i have one little bit issue while routing the path using angular.js.I am explaining my code below.
app.js:
var GoFastoApp=angular.module('GofastoHome',['ngRoute']);
GoFastoApp.config(function($routeProvider) {
$routeProvider
.when('/',{
templateUrl : 'view/home.html',
controller : 'homecontroller'
})
.when('/deptinfo',{
templateUrl : 'view/info.html',
controller : 'infocontroller'
})
.when('/TimeTable',{
templateUrl : 'view/time.html',
controller : 'timecontroller'
})
.when('/course',{
templateUrl : 'view/course.html',
controller : 'coursecontroller'
})
.when('/subject',{
templateUrl : 'view/subject.html',
controller : 'subjectcontroller'
})
.when('/hod',{
templateUrl : 'view/hod.html',
controller : 'hodcontroller'
})
.when('/faculty',{
templateUrl : 'view/faculty.html',
controller : 'facultycontroller'
})
})
When i am typing the url oditek.in/Gofast/
on the address bar of browser the required page is coming but after getting the page the the address bar url is showing oditek.in/Gofast/#/
.Here i am getting the unwanted #
with this url and need to remove this.Please help me to resolve this problem.
Upvotes: 0
Views: 34
Reputation: 6608
You need to enable html5Mode
and also specify the <base>
URL value in your markup like below.
app.js
GoFastoApp.config(function($routeProvider, $locationProvider) {
$locationProvider.html5Mode({
enabled: true,
requireBase: true
});
// remaining router config goes here
});
Usually it's preferred to have <base>
inside your <head>
, but if you have CSS & JS files outside of <head>
, then add it at the bottom of your HTML page, probably after all CSS and JS files, before closing the <body>
, define the baseURI like below.
<base href="/Gofast/">
Upvotes: 2