Reputation: 222498
I'm considering using non-Angular transport to load templates asynchronously (actually I would like to decide on build time if the template is a string or a promise coming from the request), like
@Component({
directives: [],
selector: 'some',
template: System.import('./some-template!text')
})
export class SomeComponent {}
Can a promise (coming from request) be provided as component template?
Is there some kind of templateProvider
functionality for directives/components?
Upvotes: 0
Views: 243
Reputation: 24945
Type of template is string, see source.
Alternatively you can use
templateUrl: 'relative/path/from/index.html/some-template.html'
I tried to do the impossible with IIFE
and System.import
with no luck.
You can try with IIFE
and your own module loader to load templates
synchronously
. asynchronously
I don't think would work.
See this, why you have to use IIFE
.
Upvotes: 1