fix(upgrade): allow functions for template and templateUrl (#9022)
This commit is contained in:

committed by
Miško Hevery

parent
53083c0b52
commit
a19c4e8f9a
@ -133,9 +133,9 @@ export class UpgradeNg1ComponentAdapterBuilder {
|
||||
compileTemplate(compile: angular.ICompileService, templateCache: angular.ITemplateCacheService,
|
||||
httpBackend: angular.IHttpBackendService): Promise<any> {
|
||||
if (this.directive.template !== undefined) {
|
||||
this.linkFn = compileHtml(this.directive.template);
|
||||
this.linkFn = compileHtml(typeof this.directive.template === 'function' ? this.directive.template() : this.directive.template);
|
||||
} else if (this.directive.templateUrl) {
|
||||
var url = this.directive.templateUrl;
|
||||
var url = typeof this.directive.templateUrl === 'function' ? this.directive.templateUrl() : this.directive.templateUrl;
|
||||
var html = templateCache.get(url);
|
||||
if (html !== undefined) {
|
||||
this.linkFn = compileHtml(html);
|
||||
|
Reference in New Issue
Block a user