Notification Overview
The Notification is a brief message which provides information about the status of an application process.
You can create notifications dynamically by using the NotificationService
. For more information, refer to the article on Notification settings.
Basic Usage
The following example demonstrates the Notification in action.
import { Component, ViewEncapsulation } from '@angular/core';
import { NotificationService } from '@progress/kendo-angular-notification';
@Component({
selector: 'my-app',
template: `
<button class="k-button" (click)="show()">Save data</button>
`,
styles: [`
.button-notification {
padding: 10px 5px;
color: #313536;
}
`],
encapsulation: ViewEncapsulation.None
})
export class AppComponent {
constructor(
private notificationService: NotificationService
) {}
public show(): void {
this.notificationService.show({
content: 'Your data has been saved. Time for tea!',
cssClass: 'button-notification',
animation: { type: 'slide', duration: 400 },
position: { horizontal: 'center', vertical: 'bottom' },
type: { style: 'success', icon: true },
closable: true
});
}
}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NotificationModule } from '@progress/kendo-angular-notification';
import { AppComponent } from './app.component';
@NgModule({
bootstrap: [AppComponent],
declarations: [AppComponent],
imports: [BrowserModule, BrowserAnimationsModule, NotificationModule]
})
export class AppModule { }
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
enableProdMode();
const platform = platformBrowserDynamic();
platform.bootstrapModule(AppModule);
Installation
Either use the quick setup (Angular CLI v6 or later) or manually add the package (Angular CLI v5 or earlier).
Quick Setup with Angular CLI v6 or Later
Angular CLI v6 supports the addition of packages through the ng add
command which executes in one step the set of otherwise individually needed commands.
ng add @progress/kendo-angular-notification
Manual Setup
-
Download and install the package.
npm install --save @progress/kendo-angular-notification @progress/kendo-angular-common
-
Once installed, import the NotificationModule in your application root or feature module.
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { NotificationModule } from '@progress/kendo-angular-notification'; import { AppComponent } from './app.component'; @NgModule({ bootstrap: [AppComponent], declarations: [AppComponent], imports: [BrowserModule, BrowserAnimationsModule, NotificationModule] }) export class AppModule { }
You are required to install one of the Kendo UI themes for Angular to style your component. For more information on how to add the styles, refer to the section on styling.
Dependencies
The Notification package requires you to install the following peer dependencies in your application:
- @angular/animations
- @angular/common
- @angular/core
- rxjs
- @progress/kendo-angular-l10n
- @progress/kendo-angular-common
The Notification package utilizes the Angular animation system, which supports a specific set of browsers.
Functionality and Features
- Notification types
- Animations
- Content
- Positioning
- Hiding Notifications
- Appending the Notification to dynamic containers