You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Can we change the name to ng-app-base - to better map to the previous
idea of using base[href] and to prevent confusion with $rootScope and root
element?
This would be extremely helpful. What are the main difficulties with that? Naively thinking, every component that loads a template or similar just needs to prepend the app base url.
As of angular 1.2.0 rc2 the only way to make html5mode work in non-pushstate browsers if your app is in a subdirectory is to use the <base href="" > tag. So the ability to specify app root in another way would be great.
@pholly This does not fix the issue of angular app being in a subdirectory. It is completely broken if using ui-router (which generates urls relative to the root / and not the base href).
Also, is anyone still interested in this? How did you solve your problems? This issue seems to have died...
P.S.: Issue #2805 seemed very relevant and much easier to implement. Did anyone succeed?
Make sure all paths are lowercase so we can match routes
appModule.config(function($urlRouterProvider){// This is taken from a post somewhere here on the forums// I modified it so it doesn't return a url. Rather it changes the location directly. // I only wanted the path to be lowercased so my ids in query string parameters don't get lowercased.// So rather than reconstructing the url to return I just set the $location.path and replace the $location.$urlRouterProvider.rule(function($injector,$location){varpath=$location.path(),normalized=path.toLowerCase();if(path!=normalized){//instead of returning a new url string, I'll just change the $location.path directly!$location.replace().path(normalized);}});})
I think that there should be the ability to set the "base" path for both $location and $resource/$http separate from the html <base> path.
In my opinion there is a logical flaw with keying off of the "base href" value for everything, because these three components are functionally decoupled.
The base for html assets (images, fonts, etc.) shares no functional relation to the base for API endpoints, nor the URL paths in an application.
It's coincidental if the base for these three components is the same -- this only occurs if all three are on the same domain and path level.
The best place for the configuration of these providers is in config... I disagree with creating a directive to configure $location, and even more so for configuring $resource. I think it's silly to configure services in the template when they perform no direct operations on or in it.
Furthermore I don't think there is ever a case where you would want to change the base path after the config phase, and creating directives with read-only attributes to configure only causes confusion (such as, 'why doesn't <html ng-location-base-path="{{locationBase}}"> work when I change $rootScope.locationBase?)
I kind of agree with @taylorcode here: #3102 (comment). @IgorMinar and @geddski can we reconsider splitting the configuration of "root" paths for the different components and configuring them in their respective providers instead of a directive?
Activity
petebacondarwin commentedon Jul 1, 2013
Can we change the name to
ng-app-base- to better map to the previousidea of using base[href] and to prevent confusion with $rootScope and root
element?
On 1 July 2013 07:15, Dave Geddes notifications@github.com wrote:
petebacondarwin commentedon Jul 1, 2013
Oh, just read your comment in #2805 (comment).
I still think ng-app-root is confusing. Perhaps
ng-app-root-url?Narretz commentedon Aug 22, 2013
This would be extremely helpful. What are the main difficulties with that? Naively thinking, every component that loads a template or similar just needs to prepend the app base url.
pholly commentedon Oct 15, 2013
As of angular 1.2.0 rc2 the only way to make html5mode work in non-pushstate browsers if your app is in a subdirectory is to use the
<base href="" >tag. So the ability to specify app root in another way would be great.drozzy commentedon Dec 5, 2013
@pholly This does not fix the issue of angular app being in a subdirectory. It is completely broken if using ui-router (which generates urls relative to the root / and not the base href).
Also, is anyone still interested in this? How did you solve your problems? This issue seems to have died...
P.S.: Issue #2805 seemed very relevant and much easier to implement. Did anyone succeed?
Narretz commentedon Dec 19, 2013
+1
pholly commentedon Dec 19, 2013
@drozzy @Narretz I have it all working. Here are my settings:
The root of my app is
/LibraryModule Config
Set html5Mode
Make sure all paths are lowercase so we can match routes
Routing table
In the Head tag of my server-side html for the app I add a base tag with a full url so it works in IE also
The
@syntax is for C# Razor but I think it's clear what the point is. Use the full Url. Trailing slash or not doesn't matter.Let me know if there's something I left out. But I tested in pushstate and non-pushstate browsers and it works.
Philip
taylorcode commentedon Sep 16, 2014
I think that there should be the ability to set the "base" path for both $location and $resource/$http separate from the html
<base>path.In my opinion there is a logical flaw with keying off of the "base href" value for everything, because these three components are functionally decoupled.
The base for html assets (images, fonts, etc.) shares no functional relation to the base for API endpoints, nor the URL paths in an application.
It's coincidental if the base for these three components is the same -- this only occurs if all three are on the same domain and path level.
The best place for the configuration of these providers is in config... I disagree with creating a directive to configure $location, and even more so for configuring $resource. I think it's silly to configure services in the template when they perform no direct operations on or in it.
Furthermore I don't think there is ever a case where you would want to change the base path after the config phase, and creating directives with read-only attributes to configure only causes confusion (such as, 'why doesn't
<html ng-location-base-path="{{locationBase}}">work when I change$rootScope.locationBase?)davidbilge commentedon Oct 13, 2014
+1
GeertJohan commentedon Mar 22, 2015
+1
andrewferk commentedon Mar 23, 2015
+1
3 remaining items
jackvsworld commentedon May 13, 2015
+1
ogennadi commentedon Jun 8, 2015
+1
janjaali commentedon Jun 12, 2015
+1
mjrk commentedon Jul 6, 2015
+1
rcollette commentedon Jul 6, 2015
+1
codeofsumit commentedon Sep 8, 2015
+1
petebacondarwin commentedon Sep 8, 2015
I kind of agree with @taylorcode here: #3102 (comment).
@IgorMinar and @geddski can we reconsider splitting the configuration of "root" paths for the different components and configuring them in their respective providers instead of a directive?
LunarDevelopment commentedon Sep 14, 2015
I'm having issues with
doesn't work for this, nor does .htaccess (As I'd have to place the .htaccess in root folder)$httpget/ post etc working, is there a fix for$httprequests base href?pietrotull commentedon Apr 8, 2016
+1