New to Kendo UI for Angular? Start a free 30-day trial
POPUP_CONTAINER
Used to inject the Popup container. If not provided, the first root component of the application is used.
The
POPUP_CONTAINER
can be used only with thePopupService
class.
In case you are using standalone components:
ts
import { Component } from '@angular/core';
import { KENDO_POPUP, PopupService } from '@progress/kendo-angular-popup';
@Component({
standalone: true,
imports: [KENDO_POPUP],
providers: [PopupService, {
provide: POPUP_CONTAINER,
useFactory: () => {
//return the container ElementRef, where the popup will be injected
return { nativeElement: document.body } as ElementRef;
}
}],
selector: 'app-root',
templateUrl: './app.component.html',
})
export class AppComponent {}
In case you are using an NgModule-based application:
ts
import { PopupModule, POPUP_CONTAINER } from '@progress/kendo-angular-popup';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { ElementRef, NgModule } from '@angular/core';
import { AppComponent } from './app.component';
@NgModule({
declarations: [AppComponent], // declare app component
imports: [BrowserModule, PopupModule], // import Popup module
bootstrap: [AppComponent],
providers: [{
provide: POPUP_CONTAINER,
useFactory: () => {
//return the container ElementRef, where the popup will be injected
return { nativeElement: document.body } as ElementRef;
}
}]
})
export class AppModule {}
platformBrowserDynamic().bootstrapModule(AppModule);