New to Kendo UI for Angular? Start a free 30-day trial
POPUP_CONTAINER
Injects the Popup container. If not set, uses the first root component of the application.
Use
POPUP_CONTAINER
only with thePopupService
class (see example).
In 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 NgModule-based applications:
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],
imports: [BrowserModule, PopupModule],
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);