diff --git a/modules/angular2/src/core/compiler/compiler.js b/modules/angular2/src/core/compiler/compiler.js index 06f53b040c..a27f334730 100644 --- a/modules/angular2/src/core/compiler/compiler.js +++ b/modules/angular2/src/core/compiler/compiler.js @@ -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. diff --git a/modules/angular2/test/core/compiler/compiler_spec.js b/modules/angular2/test/core/compiler/compiler_spec.js index 6ca3d46ae4..cad4a8b552 100644 --- a/modules/angular2/test/core/compiler/compiler_spec.js +++ b/modules/angular2/test/core/compiler/compiler_spec.js @@ -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) => {