Dynamic edit mode in Angular Inplace editor component

19 Sep 20223 minutes to read

At component initial load, if you want to open editor state without interacting In-place Editor input element, it can be achieved by configuring the enableEditMode property to true.

In the following sample, editor opened at initial load and when toggling a checkbox, it will remove or open the editor.

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

    selector: 'app-root',
    template: `
    <div id='container'>
    <table class="table-section">
            <td> EnableEditMode: </td>
                <ejs-checkbox id="enable" label="Enable" [checked]="true" (change)="onChange($event)"></ejs-checkbox>
            <td class="sample-td"> Enter your name: </td>
            <td class="sample-td">
                <ejs-inplaceeditor #element id="element" mode="Inline" value="Andrew" enableEditMode="true" actionOnBlur="Ignore" [model]="model"></ejs-inplaceeditor>

export class AppComponent {
    @ViewChild('element') editObj: InPlaceEditorComponent;
    public model: object = { placeholder: 'Enter some text' };
    public onChange(e: ChangeEventArgs): void {
        this.editObj.enableEditMode = e.checked;
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { InPlaceEditorAllModule } from '@syncfusion/ej2-angular-inplace-editor';
import { CheckBoxModule, ButtonModule } from '@syncfusion/ej2-angular-buttons';
import { AppComponent } from './app.component';

 * Module
    imports: [
        BrowserModule, InPlaceEditorAllModule, CheckBoxModule, ButtonModule
    declarations: [AppComponent],
    bootstrap: [AppComponent]
export class AppModule { }
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';