We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get started easily with Syncfusion Angular 7 Rich Text Editor?

Platform: JavaScript - EJ 2 |
Control: RichTextEditor |
Published Date: November 26, 2018 |
Last Revised Date: August 10, 2020

A quick start project that helps you to create an Angular 7 Rich Text Editor with a minimal code configuration.

Angular 7 Rich Text Editor

The following section explains the steps required to create a simple Angular 7 Rich Text Editor component.

Project prerequisites

Make sure that you have the compatible versions of TypeScript and Angular in your machine before starting to work on this project.


The Angular 7 Rich Text Editor used in this project is created from the Syncfusion `ej2-angular-richtexteditor` package. You can simply define it as `<ejs-richtexteditor></ejs-richtexteditor>` within the template.


Before starting with this project, the Angular 7 Rich Text Editor requires to add the Syncfusion `ej2-angular-richtexteditor` package from npmjs, which are distributed in npm as @syncfusion scoped packages.

Creating Angular Project

To create the Angular project using the Angular CLI tool, follow the steps:

  1. Install the Angular CLI application in your machine.
    npm install @angular/cli@7.0.4



If you would like to follow and run the application in Angular6 or Angular5 or Angular4, you need to replace the CLI command version number with the corresponding angular version number.


npm install -g @angular-cli@<CLI VERSION>

  1. Now, create a new Angular project by using the command `ng new` and navigate to that folder.
    ng new <project name>
    cd <project name>
  1. Install the ej2-angular-richtexteditor package through the npm install command.
    npm install @syncfusion/ej2-angular-richtexteditor --save

Adding Angular 7 Rich Text Editor

You can add the Angular 7 Rich Text Editor component by using the `ejs-richtexteditor` directive, and the attributes used within this tag allows you define other Rich Text Editor functionalities. To add the Angular 7 Rich Text Editor, follow the steps:

  1. Import the RichTextEditorAllModule into the app.module.ts file from the ej2-angular-richtexteditor package.
  2. Import and inject the other required modules within the providers section of app.module.ts.


import { BrowserModule } from '@angular/platform-browser';
import { RichTextEditorAllModule } from '@syncfusion/ej2-angular-richtexteditor';
import { NgModule } from '@angular/core';
import { FormsModule }   from '@angular/forms';
import { AppComponent } from './app.component';
  declarations: [
  imports: [
    BrowserModule, FormsModule, RichTextEditorAllModule
  bootstrap: [AppComponent]
export class AppModule { }


  1. Define the Angular Rich Text Editor code within the app.component.html file, which is mapped against the templateUrl option in the app.component.ts file.




  1. Refer to the CDN link of CSS reference within the index.html file.


<link href="https://cdn.syncfusion.com/ej2/material.css" rel="stylesheet" />


  1. Run the application with the ng serve command, and an empty Rich Text Editor will be displayed in browser.  Now, you can load the Rich Text Editor with data.



RTE default

Toolbar items configuration

If you are already imported `RichTextEditorAllModule` in app.module.ts then you don’t need to import all the required modules services separately in the providers section which are mentioned below.

To configure the toolbar options in the Rich Text Editor, import the required module services from the ej2-angular-richtexteditor package. Then, mention it in the providers section within the app.component.ts file.

By default, the Rich Text Editor does not display the toolbar. To configure toolbar items in, use `toolbarSettings` property.


import { Component } from '@angular/core';
    import { ToolbarService, LinkService, ImageService, HtmlEditorService, TableService } from '@syncfusion/ej2-angular-richtexteditor';
    selector: 'app-root',
    templateUrl: './app.component.html',    providers: [ToolbarService, LinkService, ImageService, HtmlEditorService, TableService]
    export class AppComponent  {
        public tools: object = {
         items: [
                'Bold', 'Italic', 'Underline', 'StrikeThrough', '|',
                'FontName', 'FontSize', 'FontColor', 'BackgroundColor', '|',
                'LowerCase', 'UpperCase', '|', 'Undo', 'Redo', '|',
                'Formats', 'Alignments', '|', 'OrderedList', 'UnorderedList', '|',
                'Indent', 'Outdent', '|', 'CreateLink','CreateTable',
                'Image', '|', 'ClearFormat', 'Print', 'SourceCode', '|', 'FullScreen']



<ejs-richtexteditor #toolsRTE id='alltoolRTE' [toolbarSettings]='tools' > </ ejs-richtexteditor>



RTE toolbar

Setting value on Rich Text Editor

You can populate value to the Rich Text Editor by binding the string data to it, through the `value` property at component initialization. [app.component.ts]

import { Component } from '@angular/core';
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
export class AppComponent {
  public value: string = `
    <p>The RichTextEditor triggers events based on its actions. </p>
      <p> The events can be used as an extension point to perform custom operations.</p>`                             


Now, assign this value to the `value` property of Angular Rich Text Editor within the app.component.html file.


<ejs-richtexteditor id='defaultRTE' [(value)]='value' ></ejs-richtexteditor>



Adding content for RTE

Getting the value on form submit

By using the ngModel, you can get the value from the ngform submit.


import { Component,ViewChild } from '@angular/core';
import {NgForm} from '@angular/forms';
import { ToolbarService, LinkService, ImageService, HtmlEditorService, RichTextEditorComponent } from '@syncfusion/ej2-angular-richtexteditor';
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
export class AppComponent {
    private rteEle: RichTextEditorComponent;
    public value: string = null;
      rteCreated(): void {
    onSubmit(form: NgForm): void {



    <div id='content' class='box-form' style="margin: 0 auto; max-width:750px; padding:25px">
        <form (ngSubmit)="onSubmit(rteForm)" #rteForm="ngForm">
            <div class="form-group">
                <ejs-richtexteditor #fromRTE #name='ngModel' [(value)]='value' required name="name" [(ngModel)]="value"
                <div *ngIf="(name.invalid && name.touched)" class="alert alert-danger">
                    <div *ngIf="name.errors.required">
                        Value is required.
            <div id="btn-container">
                <button type="submit" ejs-button [disabled]="!rteForm.valid">Submit</button>
                <button type="reset" ejs-button style="margin-left: 20px">Reset</button>
    .alert-danger {
        color: #a94442;
        background-color: #f2dede;
        border-color: #ebccd1;
  #btn-container {
    margin-top: 10px;


Run the application by using “ng serve” command from its root folder.

Now, you can view the Angular Rich Text Editor output as follows in browser.

ScreenshotForm validation

There are more options to explore with Angular 7 Rich Text Editor, and you can also try to play with the downloadable example link in this knowledge base article.

Downloadable example link: Angular 7 Rich Text Editor


You must log in to leave a comment
Shubham Tyagi
Feb 20, 2019

Hi, I am using your text editor.  After storing the content, I want to display the content as plain text.

Prince Oliver [Syncfusion]
Feb 20, 2019

Hi Shubham,


You can get the text in RTE control using the getText method in the control which are accessible via control’s instance. This text content can be displayed according to your requirement in a dialog or a preview area.


getText – to retrieve Text content in the RichTextEditor: https://ej2.syncfusion.com/documentation/api/rich-text-editor#gettext


If you require to display the stored content in RTE. Then you can use value property and assign the store content to display it in RTE.


value – to specify the value displayed in the RichTextEditor: https://ej2.syncfusion.com/documentation/api/rich-text-editor#value




Aug 26, 2019

hi, i want to resize text editor so how can i decrease width and height of text editor please share me the solution Thanks in advance

Pandiyaraj Muniyandi [Syncfusion]
Sep 02, 2019

Hi Swapnil,

Currently we not have resize support in our EJ2 RTE control. We have added it to our feature request list, currently working this feature with high priority.

We will let you know when this feature is implemented. You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link: https://www.syncfusion.com/feedback/6442/

Also, we have achieved your requirement at sample level, until we complete this feature use this below workaround https://stackblitz.com/edit/vphzk1-vczb3y?file=index.ts

Regards, Pandiyaraj M

Pandiyaraj Muniyandi [Syncfusion]
Oct 24, 2019

Hi Swapnil,

We provided resize support in our RichTextEditor component. Check this below reference links

Sample: https://ej2.syncfusion.com/angular/demos/#/material/rich-text-editor/resize-editor API: https://ej2.syncfusion.com/angular/documentation/api/rich-text-editor/#enableresize

Regards, Pandiyaraj

Snehal Patel
Oct 24, 2019

jmmk,m k,code tecode text herext here`` mnb- list text here

heading textemphasized text

Pandiyaraj Muniyandi [Syncfusion]
Nov 11, 2019

Hi Snehal,

Can you explain your query clearly?

Regards, Pandiyaraj

Nov 11, 2019


Pandiyaraj Muniyandi [Syncfusion]
Nov 11, 2019

Hi Siddu,

We couldn't understand your comments, can you explained it?



Kanchan Chaudhary
Dec 05, 2019

Will it work on Angular 8 ?

Pandiyaraj Muniyandi [Syncfusion]
Dec 05, 2019

Hi Kanchan,

Yes, our EJ2 RichTextEditor support in Angular 8.

Regards, Pandiyaraj

Kanchan Chaudhary
Dec 05, 2019

Thanks Pandiyaraj Muniyandi for the quick response . I tried adding RichTextEditor n Angular 8 project but it is not working. I am not getting any error for this, but RichTextEditor is not showing up. Can you let me know if I am missing out anything.

Pandiyaraj Muniyandi [Syncfusion]
Dec 05, 2019

Hi Kanchan,

Our RichTexteditor component works properly in Angular 8 from our end. Check the below sample for reference


If you still facing any issues, kindly share the issue reproducing sample to us which help us to provide solution at earliest.



Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile