CKEditor In Angular

In this article, we will figure it out how to utilize CKEditor in the angular Application.

So, we should see an extremely straightforward advance and get it exceptionally basic model here.

Step 1:

Create an Angular Application Using Following Command

ng new ck-editor
cd ck-editor

Step 2:

Add the following package to your application.

npm install ckeditor4-angular

Step 3:

Add below code in your app.module.ts file.

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { CKEditorModule } from 'ckeditor4-angular';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';

  declarations: [
  imports: [
  providers: [],
  bootstrap: [AppComponent]

Step 4:

Add below code in your app.component.ts file.

import { Component } from '@angular/core';

  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
export class AppComponent {
  title = 'ck-editor';
  name = 'Angular';
  public model = {
      name: 'Krishna',
      description: '<p>This is a sample form using CKEditor 4.</p>'
  onSubmit() {
      console.log( `Form submit, model: ${ JSON.stringify( this.model ) }` );

Step 5:

Add below code in your app.component.html file

<form (ngSubmit)="onSubmit()">
  <h1>Angular CKEditor Example -</h1>

    <label for="name">Name</label>
    <input [(ngModel)]="" type="text" name="name" id="name">

  <label for="description">Description</label>

  <button type="submit">Submit</button>

Step 6:

Run Angular Application

ng serve


Submit a Comment

Your email address will not be published.


Select Categories