Articles in this section
Category / Section

Events of Editor Controls

1 min read

When a user interacts with your app, it's sometimes necessary to know when this happens. A click, hover, or a keyboard action are all events that you can use to call component logic within Angular.

That's what Angular event binding is all about. It's one-way data binding, in that it sends information from the view to the component class. This is opposite from property binding, where data is sent from the component class to the view.

Syncfusion Angular Components supports Event binding i.e ejclick, ejchange, select etc. Events can be bound to the controls using the event name within bracket ‘()’.

Here we triggered ejclick function of ejButton Component. Refer to the below code snippet for click event of button Component. To know more about specific events of Angular components, refer the link here

HTML:

<button type="button" ej-button text="MyButton" (ejclick)="btnclick($event)"></button>

 

 

In model file, click event handler prints the button text in console. Using this click event handler, we can get the details of button component from ‘event.model’.

Angular

import { Component } from '@angular/core';

 

@Component({

    selector: 'ej-app',

    templateUrl: './button.component.html',

})

export class ButtonComponent {

    btnclick(event){

        console.log(event.model.text);

    }

}

 

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied