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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

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

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

Angular 6 Rich Text Editor

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

Project pre-requisites

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

Angular 6 Rich Text Editor – Introduction

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

Dependencies

Before starting with this project, the Angular 6 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.
  1. Now create a new Angular project by using the command `ng new` and navigate to that folder.
  1. Install the ej2-angular-richtexteditor package through the npm install command.

Adding Angular 6 RichTextEditor

You can add the Angular 6 Rich Text Editor component by using the `ejs-richtexteditor` directive, and the attributes used within this tag allows you define other richtexteditor functionalities. To add the Angular 6 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.

[app.module.ts]

 

  1. Define the Angular RichTextEditor code within the app.component.html file which is mapped against the templateUrl option in the app.component.ts file.

[app.component.html]

 

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

[index.html]

 

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

Screenshot

Toolbar items configuration

To enable 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 change the toolbar, the `toolbarSettings` property can be used.

 [app.component.ts]

 

[app.component.html]

 

Screenshot

Setting value on Rich Text Editor

You can populate the empty Rich Text Editor with value by binding the string data to it through the `value` property initially.

 [app.component.ts]

 

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

 [app.component.html]

 

Screenshot

Getting the value on form submit

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

[app.component.ts]

 

[app.component.html]

 

Run the application with the command “ng serve” in the command prompt.

you can view the Angular RichTextEditor output with data and other settings.

Screenshot

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

Downloadable example link: Angular 6 RichTextEditor

 

 

 

 

 

 

 

ADD COMMENT
You must log in to leave a comment
Comments
Tien
Sep 25, 2019

qweqweqwe

Reply

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
Live Chat Icon