@@ -104,13 +104,13 @@ export class ComponentLoader<T> {
104
104
}
105
105
106
106
// todo: appendChild to element or document.querySelector(this.container)
107
- public show ( opts : { content ?: string | TemplateRef < any > , [ key : string ] : any } = { } ) : ComponentRef < T > {
107
+ public show ( opts : { content ?: string | TemplateRef < any > , context ?: any , [ key : string ] : any } = { } ) : ComponentRef < T > {
108
108
this . _subscribePositioning ( ) ;
109
109
this . _innerComponent = null ;
110
110
111
111
if ( ! this . _componentRef ) {
112
112
this . onBeforeShow . emit ( ) ;
113
- this . _contentRef = this . _getContentRef ( opts . content ) ;
113
+ this . _contentRef = this . _getContentRef ( opts . content , opts . context ) ;
114
114
const injector = ReflectiveInjector . resolveAndCreate ( this . _providers , this . _injector ) ;
115
115
116
116
this . _componentRef = this . _componentFactory . create ( injector , this . _contentRef . nodes ) ;
@@ -289,14 +289,15 @@ export class ComponentLoader<T> {
289
289
this . _zoneSubscription = null ;
290
290
}
291
291
292
- private _getContentRef ( content : string | TemplateRef < any > | any ) : ContentRef {
292
+ private _getContentRef ( content : string | TemplateRef < any > | any , context ?: any ) : ContentRef {
293
293
if ( ! content ) {
294
294
return new ContentRef ( [ ] ) ;
295
295
}
296
296
297
297
if ( content instanceof TemplateRef ) {
298
298
if ( this . _viewContainerRef ) {
299
- const viewRef = this . _viewContainerRef . createEmbeddedView < TemplateRef < T > > ( content ) ;
299
+ const viewRef = this . _viewContainerRef . createEmbeddedView < TemplateRef < T > > ( content , context ) ;
300
+ viewRef . markForCheck ( ) ;
300
301
return new ContentRef ( [ viewRef . rootNodes ] , viewRef ) ;
301
302
}
302
303
const viewRef = content . createEmbeddedView ( { } ) ;
0 commit comments