Search results

Integrate HTML5 Components in Angular InPlaceEditor component

02 Dec 2022 / 2 minutes to read

The In-place Editor supports adding HTML5 input components using the template property. The Template property can be given as either a string or a query selector.

As a string

The HTML element tag can be given as a string for the template property. Here, the input is rendered as an HTML template.

Copied to clipboard
template: "<div><input type='text' id='name'></input></div>"

As a ng-template

You can render other components inside In-place editor using Angular ng-template. We need to use ng-template inside the <ejs-inplaceeditor> tag with #template attribute, which is mandatory to render that template.

Copied to clipboard
<ng-template #template>
    <input id="date" value="2018-05-23" type="date">

Template mode, the value property not handled by the In-place Editor component. So, before sending a value to the server, you need to modify at actionBegin event, otherwise, an empty string will pass. In the following template sample, before submitting a data to the server, event argument and value property content updated in the actionBegin event handler.

Copied to clipboard
import { Component, ViewChild } from '@angular/core';
import { InPlaceEditorComponent, ActionBeginEventArgs } from '@syncfusion/ej2-angular-inplace-editor';

    selector: 'app-root',
    template: `
    <div id='container'>
        <span class="content-title"> Select date: </span>
        <ejs-inplaceeditor #element id="element" mode="Inline" value="2018-05-23" (actionBegin)="actionBegin($event)">
            <ng-template #template>
                <input id="date" value="2018-05-23" type="date">

export class AppComponent {
    @ViewChild('element') editObj: InPlaceEditorComponent;
    public actionBegin(e: ActionBeginEventArgs): void {
        const value = (<any>this.editObj.element.querySelector('#date')).value;
        this.editObj.value = value;
        (<any>e).value = value;
Copied to clipboard
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { InPlaceEditorAllModule } from '@syncfusion/ej2-angular-inplace-editor';
import { AppComponent } from './app.component';

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

Copied to clipboard
<!DOCTYPE html>
<html lang="en">

    <title>Essential JS 2 InPlace Editor Sample</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="Typescript InPlace Editor Controls" />
    <meta name="author" content="Syncfusion" />
    <link href="//" rel="stylesheet" />
    <link href="index.css" rel="stylesheet" />

    <script src=""></script>
    <script src=""></script>
    <script src=""></script>
    <script src=""></script>
    <script src=""></script>
    <script src="systemjs.config.js"></script>
        <div id='loader'>LOADING....</div>
Copied to clipboard
#container {
    display: flex;
    justify-content: center;

#loader {
    color: #008cff;
    height: 40px;
    left: 45%;
    position: absolute;
    top: 45%;
    width: 30%;

#element {
    width: 150px;

.content-title {
    font-weight: 500;
    margin-right: 20px;
    display: flex;
    align-items: center;