fix(compiler): only sets viewDefinition absUrl if the view has either a template or templateUrl

fixes #1326
closes #1327
This commit is contained in:
Matthew Hill 2015-04-12 18:03:01 +01:00 committed by Tobias Bosch
parent b9eab463f7
commit 3d62546314
2 changed files with 9 additions and 1 deletions

View File

@ -205,7 +205,7 @@ export class Compiler {
var templateAbsUrl = null;
if (isPresent(view.templateUrl)) {
templateAbsUrl = this._urlResolver.resolve(componentUrl, view.templateUrl);
} else {
} else if (isPresent(view.template)) {
// Note: If we have an inline template, we also need to send
// the url for the component to the renderer so that it
// is able to resolve urls in stylesheets.

View File

@ -105,6 +105,14 @@ export function main() {
});
}));
it('should not fill absUrl given no inline template or template url', inject([AsyncTestCompleter], (async) => {
cmpUrlMapper.setComponentUrl(MainComponent, '/mainComponent');
captureTemplate(new View({template: null, templateUrl: null})).then( (renderTpl) => {
expect(renderTpl.absUrl).toBe(null)
async.done();
});
}));
it('should fill absUrl given url template', inject([AsyncTestCompleter], (async) => {
cmpUrlMapper.setComponentUrl(MainComponent, '/mainComponent');
captureTemplate(new View({templateUrl: '/someTemplate'})).then( (renderTpl) => {