@angular/cdk/portal#ComponentType TypeScript Examples
The following examples show how to use
@angular/cdk/portal#ComponentType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: dialog.service.ts From alauda-ui with MIT License | 6 votes |
open<T, D = any, R = any>(
compOrTempRef: ComponentType<T> | TemplateRef<T>,
config: DialogConfig<D> = null,
): DialogRef<T, R> {
this.hiddenPrevDialog();
config = { ...new DialogConfig(), ...config };
const overlayRef = this.createOverlay(config);
const dialogIns = this.attachDialog(overlayRef, config);
const dialogRef = this.attachDialogContent<T, D, R>(
compOrTempRef,
dialogIns,
overlayRef,
config,
);
this.openDialogs.push(dialogRef);
dialogRef.updatePosition().updateSize();
dialogRef.afterClosed().subscribe(() => {
this.removeDialog(dialogRef);
this.showPrevDialog();
});
return dialogRef;
}
Example #2
Source File: dialog.service.ts From alauda-ui with MIT License | 6 votes |
private attachDialogContent<T, D, R>(
compOrTempRef: ComponentType<T> | TemplateRef<T>,
dialogIns: DialogComponent,
overlayRef: OverlayRef,
config: DialogConfig<D>,
): DialogRef<T, R> {
const dialogRef = new DialogRef<T, R>(
overlayRef,
dialogIns,
this.scrollDispatcher,
this.ngZone,
);
if (compOrTempRef instanceof TemplateRef) {
dialogIns.attachTemplatePortal(
new TemplatePortal(compOrTempRef, null, {
$implicit: config.data,
} as any),
);
} else {
const injector = this.createInjector(config, dialogRef, dialogIns);
const contentRef = dialogIns.attachComponentPortal<T>(
new ComponentPortal(compOrTempRef, null, injector),
);
dialogRef.componentInstance = contentRef.instance;
}
return dialogRef;
}
Example #3
Source File: base-message.ts From alauda-ui with MIT License | 6 votes |
constructor(
protected overlay: Overlay,
protected injector: Injector,
protected applicationRef: ApplicationRef,
protected cfr: ComponentFactoryResolver,
protected overlayPaneClassName: string,
protected wrapperClass: ComponentType<Wrapper>,
protected componentClass: ComponentType<Component>,
protected globalConfig: MessageGlobalConfig,
) {
this.initWrapperContainer();
}
Example #4
Source File: edit.ts From json-schema-form with Apache License 2.0 | 6 votes |
/**
* get access to parent object's fields
*
* @param schemaChange signal a change
* @param name the current property name (key)
* @param schema the current schema
* @param parent the parent's schema (required in order to change the order)
* @param dialog dialog service
*/
constructor(
private schemaChange: EventEmitter<void>, private name: string, private schema: Schema, private parent: Schema,
private dialog: MatDialog, private component: ComponentType<any>) {
}
Example #5
Source File: json-schema-form.component.ts From json-schema-form with Apache License 2.0 | 6 votes |
/**
* component constructor
* @param http http client
* @param componentFactoryResolver allows dynamic components
* @param service application service for registering components etc.
* @param dialog dialog service
*/
constructor(
private http: HttpClient,
private componentFactoryResolver: ComponentFactoryResolver,
public service: JsonSchemaFormService,
private dialog: MatDialog,
@Inject(EDIT_DIALOG_TOKEN) private component: ComponentType<any>) { }
Example #6
Source File: dialog.factory.ts From WowUp with GNU General Public License v3.0 | 5 votes |
public getDialog<T, K>(component: ComponentType<T>, config?: MatDialogConfig<K>): MatDialogRef<T, any> {
return this._dialog.open(component, config);
}
Example #7
Source File: base-tooltip.ts From alauda-ui with MIT License | 5 votes |
protected componentClass: ComponentType<any> = TooltipComponent;
Example #8
Source File: edit-dialog-token.ts From json-schema-form with Apache License 2.0 | 5 votes |
EDIT_DIALOG_TOKEN: InjectionToken<ComponentType<any>> =
new InjectionToken<ComponentType<any>>('EDIT_DIALOG_TOKEN')
Example #9
Source File: calendar.ts From angular-material-components with MIT License | 5 votes |
/** An input indicating the type of the header component, if set. */
@Input() headerComponent: ComponentType<any>;
Example #10
Source File: datetime-picker.component.ts From angular-material-components with MIT License | 5 votes |
/** An input indicating the type of the custom header component for the calendar, if set. */
@Input() calendarHeaderComponent: ComponentType<any>;
Example #11
Source File: calendar.ts From ngx-mat-datetime-picker with MIT License | 5 votes |
/** An input indicating the type of the header component, if set. */
@Input() headerComponent: ComponentType<any>;
Example #12
Source File: datetime-picker.component.ts From ngx-mat-datetime-picker with MIT License | 5 votes |
/** An input indicating the type of the custom header component for the calendar, if set. */
@Input() calendarHeaderComponent: ComponentType<any>;