Skip to content

Commit 3d62546

Browse files
Matthew Hilltbosch
authored andcommitted
fix(compiler): only sets viewDefinition absUrl if the view has either a template or templateUrl
fixes #1326 closes #1327
1 parent b9eab46 commit 3d62546

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

modules/angular2/src/core/compiler/compiler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ export class Compiler {
205205
var templateAbsUrl = null;
206206
if (isPresent(view.templateUrl)) {
207207
templateAbsUrl = this._urlResolver.resolve(componentUrl, view.templateUrl);
208-
} else {
208+
} else if (isPresent(view.template)) {
209209
// Note: If we have an inline template, we also need to send
210210
// the url for the component to the renderer so that it
211211
// is able to resolve urls in stylesheets.

modules/angular2/test/core/compiler/compiler_spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ export function main() {
105105
});
106106
}));
107107

108+
it('should not fill absUrl given no inline template or template url', inject([AsyncTestCompleter], (async) => {
109+
cmpUrlMapper.setComponentUrl(MainComponent, '/mainComponent');
110+
captureTemplate(new View({template: null, templateUrl: null})).then( (renderTpl) => {
111+
expect(renderTpl.absUrl).toBe(null)
112+
async.done();
113+
});
114+
}));
115+
108116
it('should fill absUrl given url template', inject([AsyncTestCompleter], (async) => {
109117
cmpUrlMapper.setComponentUrl(MainComponent, '/mainComponent');
110118
captureTemplate(new View({templateUrl: '/someTemplate'})).then( (renderTpl) => {

0 commit comments

Comments
 (0)