Removing # from URL in AngularJS [duplicate]
This question already has an answer here:
How to delete '#' sign in angular-ui-router URLs
3 answers
I am using UI-route where state provider is used.
My application is built on AngularJS on the express server(not apache server).
The problem is the URL of the pages.
URL looks like :
http://localhost:3006/#!/home
What I want to look like :
http://localhost:3006/home or http://localhost:3006/!/home
Can someone help me to do this?
I search this on Google but I find the solution with apache server.
As well as I use
$locationProvider.hashPrefix('');
$locationProvider.html5Mode(true);
But it show this error :
TypeError: Cannot read property 'hashPrefix' of undefined
at http://localhost:3006/app.js:448:20
at Object.invoke (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:44:390)
at d (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:42:279)
at https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:42:418
at r (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:8:7)
at g (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:42:180)
at gb (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:46:250)
at c (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:22:19)
at Uc (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:22:332)
at we (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:21:1
angularjs url angular-ui-router
marked as duplicate by georgeawg
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 28 '18 at 14:35
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
How to delete '#' sign in angular-ui-router URLs
3 answers
I am using UI-route where state provider is used.
My application is built on AngularJS on the express server(not apache server).
The problem is the URL of the pages.
URL looks like :
http://localhost:3006/#!/home
What I want to look like :
http://localhost:3006/home or http://localhost:3006/!/home
Can someone help me to do this?
I search this on Google but I find the solution with apache server.
As well as I use
$locationProvider.hashPrefix('');
$locationProvider.html5Mode(true);
But it show this error :
TypeError: Cannot read property 'hashPrefix' of undefined
at http://localhost:3006/app.js:448:20
at Object.invoke (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:44:390)
at d (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:42:279)
at https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:42:418
at r (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:8:7)
at g (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:42:180)
at gb (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:46:250)
at c (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:22:19)
at Uc (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:22:332)
at we (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:21:1
angularjs url angular-ui-router
marked as duplicate by georgeawg
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 28 '18 at 14:35
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
How to delete '#' sign in angular-ui-router URLs
3 answers
I am using UI-route where state provider is used.
My application is built on AngularJS on the express server(not apache server).
The problem is the URL of the pages.
URL looks like :
http://localhost:3006/#!/home
What I want to look like :
http://localhost:3006/home or http://localhost:3006/!/home
Can someone help me to do this?
I search this on Google but I find the solution with apache server.
As well as I use
$locationProvider.hashPrefix('');
$locationProvider.html5Mode(true);
But it show this error :
TypeError: Cannot read property 'hashPrefix' of undefined
at http://localhost:3006/app.js:448:20
at Object.invoke (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:44:390)
at d (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:42:279)
at https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:42:418
at r (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:8:7)
at g (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:42:180)
at gb (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:46:250)
at c (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:22:19)
at Uc (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:22:332)
at we (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:21:1
angularjs url angular-ui-router
This question already has an answer here:
How to delete '#' sign in angular-ui-router URLs
3 answers
I am using UI-route where state provider is used.
My application is built on AngularJS on the express server(not apache server).
The problem is the URL of the pages.
URL looks like :
http://localhost:3006/#!/home
What I want to look like :
http://localhost:3006/home or http://localhost:3006/!/home
Can someone help me to do this?
I search this on Google but I find the solution with apache server.
As well as I use
$locationProvider.hashPrefix('');
$locationProvider.html5Mode(true);
But it show this error :
TypeError: Cannot read property 'hashPrefix' of undefined
at http://localhost:3006/app.js:448:20
at Object.invoke (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:44:390)
at d (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:42:279)
at https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:42:418
at r (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:8:7)
at g (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:42:180)
at gb (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:46:250)
at c (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:22:19)
at Uc (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:22:332)
at we (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:21:1
This question already has an answer here:
How to delete '#' sign in angular-ui-router URLs
3 answers
TypeError: Cannot read property 'hashPrefix' of undefined
at http://localhost:3006/app.js:448:20
at Object.invoke (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:44:390)
at d (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:42:279)
at https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:42:418
at r (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:8:7)
at g (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:42:180)
at gb (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:46:250)
at c (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:22:19)
at Uc (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:22:332)
at we (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:21:1
TypeError: Cannot read property 'hashPrefix' of undefined
at http://localhost:3006/app.js:448:20
at Object.invoke (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:44:390)
at d (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:42:279)
at https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:42:418
at r (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:8:7)
at g (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:42:180)
at gb (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:46:250)
at c (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:22:19)
at Uc (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:22:332)
at we (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js:21:1
angularjs url angular-ui-router
angularjs url angular-ui-router
asked Dec 28 '18 at 5:59
SumitSumit
12
12
marked as duplicate by georgeawg
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 28 '18 at 14:35
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by georgeawg
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 28 '18 at 14:35
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
please check this
https://scotch.io/tutorials/pretty-urls-in-angularjs-removing-the-hashtag
add $locationProvider in your config app.js.
after that add $locationProvider.html5Mode(true);
and last include <base href="/">
in head of your index.html
I already done this, not solved the problem
– Sumit
Dec 28 '18 at 9:58
remove this one$locationProvider.hashPrefix('');
– Akshay Pamnani
Dec 28 '18 at 10:00
I used $stateProvider
– Sumit
Dec 28 '18 at 10:03
you should change your code please refer this one. stackoverflow.com/questions/22102815/…
– Akshay Pamnani
Dec 28 '18 at 10:05
if you got success then please upvote my answer
– Akshay Pamnani
Dec 28 '18 at 10:06
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
please check this
https://scotch.io/tutorials/pretty-urls-in-angularjs-removing-the-hashtag
add $locationProvider in your config app.js.
after that add $locationProvider.html5Mode(true);
and last include <base href="/">
in head of your index.html
I already done this, not solved the problem
– Sumit
Dec 28 '18 at 9:58
remove this one$locationProvider.hashPrefix('');
– Akshay Pamnani
Dec 28 '18 at 10:00
I used $stateProvider
– Sumit
Dec 28 '18 at 10:03
you should change your code please refer this one. stackoverflow.com/questions/22102815/…
– Akshay Pamnani
Dec 28 '18 at 10:05
if you got success then please upvote my answer
– Akshay Pamnani
Dec 28 '18 at 10:06
add a comment |
please check this
https://scotch.io/tutorials/pretty-urls-in-angularjs-removing-the-hashtag
add $locationProvider in your config app.js.
after that add $locationProvider.html5Mode(true);
and last include <base href="/">
in head of your index.html
I already done this, not solved the problem
– Sumit
Dec 28 '18 at 9:58
remove this one$locationProvider.hashPrefix('');
– Akshay Pamnani
Dec 28 '18 at 10:00
I used $stateProvider
– Sumit
Dec 28 '18 at 10:03
you should change your code please refer this one. stackoverflow.com/questions/22102815/…
– Akshay Pamnani
Dec 28 '18 at 10:05
if you got success then please upvote my answer
– Akshay Pamnani
Dec 28 '18 at 10:06
add a comment |
please check this
https://scotch.io/tutorials/pretty-urls-in-angularjs-removing-the-hashtag
add $locationProvider in your config app.js.
after that add $locationProvider.html5Mode(true);
and last include <base href="/">
in head of your index.html
please check this
https://scotch.io/tutorials/pretty-urls-in-angularjs-removing-the-hashtag
add $locationProvider in your config app.js.
after that add $locationProvider.html5Mode(true);
and last include <base href="/">
in head of your index.html
answered Dec 28 '18 at 6:43
Akshay PamnaniAkshay Pamnani
215
215
I already done this, not solved the problem
– Sumit
Dec 28 '18 at 9:58
remove this one$locationProvider.hashPrefix('');
– Akshay Pamnani
Dec 28 '18 at 10:00
I used $stateProvider
– Sumit
Dec 28 '18 at 10:03
you should change your code please refer this one. stackoverflow.com/questions/22102815/…
– Akshay Pamnani
Dec 28 '18 at 10:05
if you got success then please upvote my answer
– Akshay Pamnani
Dec 28 '18 at 10:06
add a comment |
I already done this, not solved the problem
– Sumit
Dec 28 '18 at 9:58
remove this one$locationProvider.hashPrefix('');
– Akshay Pamnani
Dec 28 '18 at 10:00
I used $stateProvider
– Sumit
Dec 28 '18 at 10:03
you should change your code please refer this one. stackoverflow.com/questions/22102815/…
– Akshay Pamnani
Dec 28 '18 at 10:05
if you got success then please upvote my answer
– Akshay Pamnani
Dec 28 '18 at 10:06
I already done this, not solved the problem
– Sumit
Dec 28 '18 at 9:58
I already done this, not solved the problem
– Sumit
Dec 28 '18 at 9:58
remove this one
$locationProvider.hashPrefix('');
– Akshay Pamnani
Dec 28 '18 at 10:00
remove this one
$locationProvider.hashPrefix('');
– Akshay Pamnani
Dec 28 '18 at 10:00
I used $stateProvider
– Sumit
Dec 28 '18 at 10:03
I used $stateProvider
– Sumit
Dec 28 '18 at 10:03
you should change your code please refer this one. stackoverflow.com/questions/22102815/…
– Akshay Pamnani
Dec 28 '18 at 10:05
you should change your code please refer this one. stackoverflow.com/questions/22102815/…
– Akshay Pamnani
Dec 28 '18 at 10:05
if you got success then please upvote my answer
– Akshay Pamnani
Dec 28 '18 at 10:06
if you got success then please upvote my answer
– Akshay Pamnani
Dec 28 '18 at 10:06
add a comment |