Custom animation in Angular Inplace editor component

27 Apr 20243 minutes to read

In popup mode, the In-place Editor rendered with the Essential JS 2 Tooltip component. You can use tooltip properties and events to customize the popup by configure properties into the model property inside the popupSettings API.

In the following sample, popup animation can be customized by passing animation effect using the model property and the dynamic animation effect changes configured from the Essential JS 2 DropDownList component change event.

import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { InPlaceEditorAllModule } from '@syncfusion/ej2-angular-inplace-editor'
import { DropDownListAllModule  } from '@syncfusion/ej2-angular-dropdowns'



import { Component, ViewChild } from '@angular/core';
import { InPlaceEditorComponent } from '@syncfusion/ej2-angular-inplace-editor';
import { ChangeEventArgs } from '@syncfusion/ej2-dropdowns';

@Component({
imports: [
         InPlaceEditorAllModule, DropDownListAllModule
    ],


standalone: true,
    selector: 'app-root',
    template: `
    <div id='container'>
    <table class="table-section">
        <tr>
            <td> Open Animation: </td>
            <td>
                <div id="openDropDown"></div>
                <ejs-dropdownlist #openDropDown (change)="onChange($event)" id='openDropDown' [dataSource]='openAnimateData' value='ZoomIn' placeholder="Select a animate type" popupHeight="150px">
                </ejs-dropdownlist>
            </td>
        </tr>
        <tr>
            <td  class="sample-td"> Enter your name: </td>
            <td  class="sample-td">
                <ejs-inplaceeditor #element id="element" mode="Popup" value="Andrew" [model]="model" [popupSettings]="popupSettings"></ejs-inplaceeditor>
            </td>
        </tr>
    </table>
</div>
    `
})

export class AppComponent {
    @ViewChild('element') editObj?: InPlaceEditorComponent;
    public model: object = { placeholder: 'Enter some text' };
    public popupSettings: object = { model: { animation: { open: {effect: 'ZoomIn', duration: 1000, delay: 0}}}};
    public openAnimateData: string[] = ['None', 'FadeIn', 'FadeZoomIn', 'ZoomIn'];

    public onChange(e: ChangeEventArgs): void {
        (this.editObj as any).popupSettings.model.animation.open.effect = e.value;
        this.editObj?.dataBind();
    }
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));