import { Component } from '@angular/core'; import { MessagerService } from 'easyui/messager/messager.service'; @Component({ selector: 'app-root', template: ` <h2>Alert Messager</h2> <eui-linkbutton (click)="alert1()">Alert</eui-linkbutton> <eui-linkbutton (click)="alert2()">Error</eui-linkbutton> <eui-linkbutton (click)="alert3()">Info</eui-linkbutton> <eui-linkbutton (click)="alert4()">Question</eui-linkbutton> <eui-linkbutton (click)="alert5()">Warning</eui-linkbutton> <eui-messager></eui-messager> ` }) export class AppComponent { constructor(public messagerService: MessagerService) {} alert1() { this.messagerService.alert({ title: 'Alert', msg: 'Here is a message!' }); } alert2() { this.messagerService.alert({ title: 'Error', icon: 'error', msg: 'Here is an error message!' }); } alert3() { this.messagerService.alert({ title: 'Info', icon: 'info', msg: 'Here is a info message!' }); } alert4() { this.messagerService.alert({ title: 'Question', icon: 'question', msg: 'Here is a question message!' }); } alert5() { this.messagerService.alert({ title: 'Warning', icon: 'warning', msg: 'Here is a warning message!' }); } }
import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { BrowserModule } from '@angular/platform-browser'; import { HttpModule } from '@angular/http'; import { EasyUIModule } from 'easyui/easyui/easyui.module'; import { AppComponent } from './app.component'; @NgModule({ bootstrap: [ AppComponent ], declarations: [ AppComponent ], imports: [ FormsModule, BrowserModule, HttpModule, EasyUIModule ] }) export class AppModule { }
import { enableProdMode } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { AppModule } from './app.module'; enableProdMode(); platformBrowserDynamic().bootstrapModule(AppModule);