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.
// Import the Popup module
import { PopupModule, POPUP_CONTAINER } from '@progress/kendo-angular-popup';
// The browser platform with a compiler
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { ElementRef, NgModule } from '@angular/core';
// Import the app component
import { AppComponent } from './app.component';
// Define the app module
@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 {}
// Compile and launch the module
platformBrowserDynamic().bootstrapModule(AppModule);