-
Notifications
You must be signed in to change notification settings - Fork 25k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Base URL support in templates and stylesheets #2384
Comments
Will this solve the issue of resolving the path for a template relative to the component instead of writing the full path? @Component({
selector: 'app'
})
@View({
templateUrl: 'components/app/app.html',
directives: []
})
class App {} vs. @Component({
selector: 'app'
})
@View({
templateUrl: './app.html',
directives: []
})
class App {} |
@rolandjitsu you are looking for #2383 |
FYI @vicb updated the description |
@mhevery thanks, both this one and the other you pasted are great ideas :) |
@mhevery I just had a thought while playing with components. Whenever I load a stylesheet within a template using If so, the current proposal, will it fix this issue? Otherwise may I suggest delaying DOM injection until the styles have been loaded to avoid this flickering (there is a very obvious delay, e.g. the text is black for a few milliseconds and then suddenly it changes to the color the styling says it should be)? |
@rolandjitsu see #1694 |
|
@mhevery do we actually need this for css ? we already resolve |
As indicated in my comment above, I'm not sure if this issue makes sense for styles. Html should be enough. |
I've determined how I'm going to do this - |
…mplate. Angular fetches template HTML files outside of the browser's normal parsing flow. As a result, URLs in template files are interpreted relative to the root application, when the components defined by the template files are inserted into the DOM. This change enables a template author to prefix URLs with the string $baseUrl, which will be replaced with the relative base path of the template file. So for an example template loaded from /component/foo/template.html: <img src="$baseUrl/logo.png" /> becomes: <img src="/component/foo/logo.png" /> Addresses angular#2384.
…mplate. Angular fetches template HTML files outside of the browser's normal parsing flow. As a result, URLs in template files are interpreted relative to the root application, when the components defined by the template files are inserted into the DOM. This change enables a template author to prefix URLs with the string $baseUrl, which will be replaced with the relative base path of the template file. So for an example template loaded from /component/foo/template.html: <img src="$baseUrl/logo.png" /> becomes: <img src="/component/foo/logo.png" /> Addresses angular#2384.
…mplate. Angular fetches template HTML files outside of the browser's normal parsing flow. As a result, URLs in template files are interpreted relative to the root application, when the components defined by the template files are inserted into the DOM. This change enables a template author to prefix URLs with the string $baseUrl, which will be replaced with the relative base path of the template file. So for an example template loaded from /component/foo/template.html: <img src="$baseUrl/logo.png" /> becomes: <img src="/component/foo/logo.png" /> Addresses angular#2384.
…mplate. Angular fetches template HTML files outside of the browser's normal parsing flow. As a result, URLs in template files are interpreted relative to the root application, when the components defined by the template files are inserted into the DOM. This change enables a template author to prefix URLs with the string $baseUrl, which will be replaced with the relative base path of the template file. So for an example template loaded from /component/foo/template.html: <img src="$baseUrl/logo.png" /> becomes: <img src="/component/foo/logo.png" /> Addresses angular#2384.
…mplate. Angular fetches template HTML files outside of the browser's normal parsing flow. As a result, URLs in template files are interpreted relative to the root application, when the components defined by the template files are inserted into the DOM. This change enables a template author to prefix URLs with the string $baseUrl, which will be replaced with the relative base path of the template file. So for an example template loaded from /component/foo/template.html: <img src="$baseUrl/logo.png" /> becomes: <img src="/component/foo/logo.png" /> Addresses angular#2384.
…mplate. Angular fetches template HTML files outside of the browser's normal parsing flow. As a result, URLs in template files are interpreted relative to the root application, when the components defined by the template files are inserted into the DOM. This change enables a template author to prefix URLs with the string $baseUrl, which will be replaced with the relative base path of the template file. So for an example template loaded from /component/foo/template.html: <img src="$baseUrl/logo.png" /> becomes: <img src="/component/foo/logo.png" /> Addresses angular#2384.
…mplate. Angular fetches template HTML files outside of the browser's normal parsing flow. As a result, URLs in template files are interpreted relative to the root application, when the components defined by the template files are inserted into the DOM. This change enables a template author to prefix URLs with the string $baseUrl, which will be replaced with the relative base path of the template file. So for an example template loaded from /component/foo/template.html: <img src="$baseUrl/logo.png" /> becomes: <img src="/component/foo/logo.png" /> Addresses angular#2384.
…mplate. Angular fetches template HTML files outside of the browser's normal parsing flow. As a result, URLs in template files are interpreted relative to the root application, when the components defined by the template files are inserted into the DOM. This change enables a template author to prefix URLs with the string $baseUrl, which will be replaced with the relative base path of the template file. So for an example template loaded from /component/foo/template.html: <img src="$baseUrl/logo.png" /> becomes: <img src="/component/foo/logo.png" /> Addresses angular#2384.
…mplate. Angular fetches template HTML files outside of the browser's normal parsing flow. As a result, URLs in template files are interpreted relative to the root application, when the components defined by the template files are inserted into the DOM. This change enables a template author to prefix URLs with the string $baseUrl, which will be replaced with the relative base path of the template file. So for an example template loaded from /component/foo/template.html: <img src="$baseUrl/logo.png" /> becomes: <img src="/component/foo/logo.png" /> Addresses angular#2384.
…mplate. Angular fetches template HTML files outside of the browser's normal parsing flow. As a result, URLs in template files are interpreted relative to the root application, when the components defined by the template files are inserted into the DOM. This change enables a template author to prefix URLs with the string $baseUrl, which will be replaced with the relative base path of the template file. So for an example template loaded from /component/foo/template.html: <img src="$baseUrl/logo.png" /> becomes: <img src="/component/foo/logo.png" /> Addresses angular#2384.
…mplate. Angular fetches template HTML files outside of the browser's normal parsing flow. As a result, URLs in template files are interpreted relative to the root application, when the components defined by the template files are inserted into the DOM. This change enables a template author to prefix URLs with the string $baseUrl, which will be replaced with the relative base path of the template file. So for an example template loaded from /component/foo/template.html: <img src="$baseUrl/logo.png" /> becomes: <img src="/component/foo/logo.png" /> Addresses angular#2384.
…mplate. Angular fetches template HTML files outside of the browser's normal parsing flow. As a result, URLs in template files are interpreted relative to the root application, when the components defined by the template files are inserted into the DOM. This change enables a template author to prefix URLs with the string $baseUrl, which will be replaced with the relative base path of the template file. So for an example template loaded from /component/foo/template.html: <img src="$baseUrl/logo.png" /> becomes: <img src="/component/foo/logo.png" /> Addresses #2384.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
GOAL
Add support to the template/stylesheets for base URL so that components can refer to resources in relative paths.
Problem
where:
zippy.ts
zippy.html
Why prefix
$baseUrl
and not do it automatically?We need to mark attributes that take relative urls in html files explicitly, as we don't know which attributes are urls and which ones are not.
Also, in html files we could have something like
<img src="$baseUrl/{{img}}.gif">
Solution
baseUrl
from the module, see Relative URL support in annotations #2383template
andstylsheets
for$baseUrl
and replace with URL form the moduleThe text was updated successfully, but these errors were encountered: