last day (14 days later) » 

18:26
-2
Q: remove # from angularjs for specific urls

Kartheek sI am using angular 1.4 for frontend, .net from backend and I need some urls to be shown without # and some urls needs to be shown with #. Currently I am using state providers to navigate between pages. Example: If I am using http://example.com/ I will have the below URLs as http://example.co...

@maurycy Its project requirement. Currently we use # and they wanted to remove it for 5 pages only
what is putting them there in the first place?
@floor I didn't get you
@Kartheeks what is putting the # in eg: example.com/#/home
@floor If we didn't use html5mode... then # will append to the URL while we navigate to other pages. So I need some pages with # and some pages without #
18:26
I may be wrong but I don't think htm5Mode has anything to do with why those #### are appearing. In your routing urls do you add # anywhere? What backend are you using? You can likely using some kind url formatting rules to remove the hash for certain URLS. In php you can use .htaccess and map this: example.com/#/home to example.com/home
@floor Without html5mode it shows #. Currently I use $stateProvider and I didn't use # anywhere. We use Net backend. Please look the modified question
what happens if you change / to /test ?
url: "/", to url: "/test",
and typically you name your states
.state("/", { to .state("start", {
url: "/", to url: "/test", ---> redirects to example.com/test
and typically you name your states
.state("/", { to .state("start", { --> used to call the html page
18:42
I think because you just have a / there instead of /test it creates the #
so if you give an actual url (some letters or words) then it doesn't need to add # as a filler
because if you just leave it as /
and go somewhere deeper into the application
you would end up with //home
instead of /#/home
its UI routers way of making the urls well structures
If you have an exact example from your code base I can work through it with you

last day (14 days later) »