@@ -225,6 +225,7 @@ export abstract class ViewContainerRef {
225225 * replace the `ngModuleRef` parameter.
226226 * * projectableNodes: list of DOM nodes that should be projected through
227227 * [`<ng-content>`](api/core/ng-content) of the new component instance.
228+ * * directives: Directives that should be applied to the component.
228229 *
229230 * @returns The new `ComponentRef` which contains the component instance and the host view.
230231 */
@@ -236,6 +237,7 @@ export abstract class ViewContainerRef {
236237 ngModuleRef ?: NgModuleRef < unknown > ;
237238 environmentInjector ?: EnvironmentInjector | NgModuleRef < unknown > ;
238239 projectableNodes ?: Node [ ] [ ] ;
240+ directives ?: Type < unknown > [ ] ;
239241 } ,
240242 ) : ComponentRef < C > ;
241243
@@ -250,6 +252,7 @@ export abstract class ViewContainerRef {
250252 * [`<ng-content>`](api/core/ng-content) of the new component instance.
251253 * @param ngModuleRef An instance of the NgModuleRef that represent an NgModule.
252254 * This information is used to retrieve corresponding NgModule injector.
255+ * @param directives Directives that should be applied to the component.
253256 *
254257 * @returns The new `ComponentRef` which contains the component instance and the host view.
255258 *
@@ -263,6 +266,7 @@ export abstract class ViewContainerRef {
263266 injector ?: Injector ,
264267 projectableNodes ?: any [ ] [ ] ,
265268 environmentInjector ?: EnvironmentInjector | NgModuleRef < any > ,
269+ directives ?: Type < unknown > [ ] ,
266270 ) : ComponentRef < C > ;
267271
268272 /**
@@ -426,6 +430,7 @@ const R3ViewContainerRef = class ViewContainerRef extends VE_ViewContainerRef {
426430 injector ?: Injector ;
427431 projectableNodes ?: Node [ ] [ ] ;
428432 ngModuleRef ?: NgModuleRef < unknown > ;
433+ directives ?: Type < unknown > [ ] ;
429434 } ,
430435 ) : ComponentRef < C > ;
431436 /**
@@ -439,6 +444,7 @@ const R3ViewContainerRef = class ViewContainerRef extends VE_ViewContainerRef {
439444 injector ?: Injector | undefined ,
440445 projectableNodes ?: any [ ] [ ] | undefined ,
441446 environmentInjector ?: EnvironmentInjector | NgModuleRef < any > | undefined ,
447+ directives ?: Type < unknown > [ ] ,
442448 ) : ComponentRef < C > ;
443449 override createComponent < C > (
444450 componentFactoryOrType : ComponentFactory < C > | Type < C > ,
@@ -451,10 +457,12 @@ const R3ViewContainerRef = class ViewContainerRef extends VE_ViewContainerRef {
451457 ngModuleRef ?: NgModuleRef < unknown > ;
452458 environmentInjector ?: EnvironmentInjector | NgModuleRef < unknown > ;
453459 projectableNodes ?: Node [ ] [ ] ;
460+ directives ?: Type < unknown > [ ] ;
454461 } ,
455462 injector ?: Injector | undefined ,
456463 projectableNodes ?: any [ ] [ ] | undefined ,
457464 environmentInjector ?: EnvironmentInjector | NgModuleRef < any > | undefined ,
465+ directives ?: Type < unknown > [ ] ,
458466 ) : ComponentRef < C > {
459467 const isComponentFactory = componentFactoryOrType && ! isType ( componentFactoryOrType ) ;
460468 let index : number | undefined ;
@@ -499,6 +507,7 @@ const R3ViewContainerRef = class ViewContainerRef extends VE_ViewContainerRef {
499507 ngModuleRef ?: NgModuleRef < unknown > ;
500508 environmentInjector ?: EnvironmentInjector | NgModuleRef < unknown > ;
501509 projectableNodes ?: Node [ ] [ ] ;
510+ directives ?: Type < unknown > [ ] ;
502511 } ;
503512 if ( ngDevMode && options . environmentInjector && options . ngModuleRef ) {
504513 throwError (
@@ -509,6 +518,7 @@ const R3ViewContainerRef = class ViewContainerRef extends VE_ViewContainerRef {
509518 injector = options . injector ;
510519 projectableNodes = options . projectableNodes ;
511520 environmentInjector = options . environmentInjector || options . ngModuleRef ;
521+ directives = options . directives ;
512522 }
513523
514524 const componentFactory : ComponentFactory < C > = isComponentFactory
@@ -553,6 +563,7 @@ const R3ViewContainerRef = class ViewContainerRef extends VE_ViewContainerRef {
553563 projectableNodes ,
554564 rNode ,
555565 environmentInjector ,
566+ directives ,
556567 ) ;
557568 this . insertImpl (
558569 componentRef . hostView ,
0 commit comments