EasyUI Forum

General Category => EasyUI for Angular => Topic started by: fengdie on May 06, 2018, 01:32:56 AM



Title: MessagerService component cannot be used
Post by: fengdie on May 06, 2018, 01:32:56 AM
<eui-messager> </ eui-messager> is not used in the template MessagerService component cannot be used
Code:
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>
        
    `
})
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!'
        });
    }
 
}

Suggest MessagerService like easyui for jquery messager components.
Don't insert <eui-messager> </ eui-messager> node