Website Development

How to add WYSIWYG in angular using Quill Js?

9 days ago
How to add WYSIWYG in angular using Quill Js?


In this tutorial I am going to show you that how to add WYSIWYG in angular using Quill js. Over the past month, I have been working on a side project using angular. And as part of this project, I needed a text editor that works really well with angular that I could include in my project. Through my research, I found a few but the best one that I found is called Quill JS. It’s not just a small editor that some just made and put on internet. It’s actually really powerful. It is used by many large companies like Linkedin, Salesforce, Slack and many more. Also what’s cool about Quill is that it does not just work with angular. It works as a standalone javascript Rich Text editor. And it also works with React.js and I believe Vue.js as well.

In this article we’re gonna be implementing quill into angular project.

Following is the screenshot of what we are going to build:

It’s a pretty blank angular project and I just set up a basic homepage with WYSIWYG in angular.

Let’s start building this step by step.

Before we begin, make sure that angular cli is installed on your computer.

By the way, I also made a video version of this article. So if want, you can also watch video:

1- Create new angular project?


Then it would ask “Which stylesheet format would you like to use?”. You can select any oneoption that suits you but I would select SCSS for now with the help of the arrow down button and press enter.

After waiting for a while, it will be installed.


2- Start the server 
Type the following code that will run and open app in a separate tab of browser.


By running the above command, it will ask you: 
“Would you like to share anonymous usage data about this project with the Angular Team at Google under Google’s Privacy Policy at https://policies.google.com/privacy?” 
Just type y and press enter.

After process is done it will open following page in a tab:

3- Install dependencies 
Now we need to install the dependencies: quill and ngx-quill 
Stop the local server and run the following command in your terminal.


After installing run sever again with the command


4- Setup and use quill in angular project 
Open your app.module.ts file and import QuilModule from ngx-quill library:


Now add the QuillModule in the “imports” array:


Next we need to import the quill’s style files.

Open the styles.scss ( or style.css if you chose css during installation of angular project ) and paste the following code on top of your global styles.scss file:


Now let’s use quill in our html file.

Open app.component.html file and add following tag in it and save:


Now you should see quill editor in action in the browser like in following screenshot: