# Integrating CKEditor 5 with Angular multi-root editor component from CDN

This page focuses on describing the usage of the multi-root editor in Angular applications. For other editor types, see the [default Angular integration](angular-default-cdn.md).

> **Experimental**
>
> The Angular multi-root editor integration is in early access. Its API is not stable and may change in any release without a major version bump.

> **Note**
>
> The multi-root editors in Angular are supported since version 13.1.0 of this package.

<a id="quick-start"></a>

## Quick start

This guide assumes you already have an Angular project. To create such a project, you can use Angular CLI. Refer to the [Angular documentation](https://angular.dev/tools/cli) to learn more.

> **Note**
>
> To use our Cloud CDN services, [create a free account](https://portal.ckeditor.com/checkout?plan=free). Learn more about [license key activation](../../../licensing/license-key-and-activation.md).

First, install the [CKEditor 5 WYSIWYG editor component for Angular](https://www.npmjs.com/package/@ckeditor/ckeditor5-angular):

```bash
npm install @ckeditor/ckeditor5-angular
```

Angular is a TypeScript-first environment, so you may need to import TypeScript types for CKEditor. Depending on the plugins and features you use, you may also need to install the required open-source and premium packages:

```bash
npm install --save-dev ckeditor5 # Open-source plugin types.
npm install --save-dev ckeditor5-premium-features # Premium features plugin types.
```

Use the `loadCKEditorCloud` helper to load the editor code and plugins from CDN, and pass the `MultiRootEditor` class it returns to the `<ckeditor-multi-root>` component. For more information about the `loadCKEditorCloud` helper, see the [Loading CDN resources](../../../setup/loading-cdn-resources.md) guide.

```angular-ts
// app.component.ts

import { Component, type OnInit } from '@angular/core';
import {
	CKEditorMultiRootComponent,
	loadCKEditorCloud,
	type CKEditorCloudResult,
	type MultiRootEditorData
} from '@ckeditor/ckeditor5-angular';
import type { EditorConfig, MultiRootEditor } from 'https://cdn.ckeditor.com/typings/ckeditor5.d.ts';

@Component( {
	selector: 'app-root',
	imports: [ CKEditorMultiRootComponent ],
	template: `
		@if ( Editor && config ) {
			<ckeditor-multi-root
				[editor]="Editor"
				[config]="config"
				[(data)]="data"
			/>
		}
	`
} )
export class AppComponent implements OnInit {
	public Editor: typeof MultiRootEditor | null = null;

	public config: EditorConfig | null = null;

	public data: MultiRootEditorData = {
		intro: '<h1>Angular multi-root editor</h1>',
		content: '<p>Hello from CKEditor 5 multi-root!</p>'
	};

	public ngOnInit(): void {
		loadCKEditorCloud( {
			version: '49.1.0',
			premium: true
		} ).then( this._setupEditor.bind( this ) );
	}

	private _setupEditor( cloud: CKEditorCloudResult<{ version: '49.1.0', premium: true }> ) {
		const { MultiRootEditor, Essentials, Paragraph, Bold, Italic } = cloud.CKEditor;
		const { FormatPainter } = cloud.CKEditorPremiumFeatures;

		this.Editor = MultiRootEditor;
		this.config = {
			licenseKey: '<YOUR_LICENSE_KEY>',
			plugins: [ Essentials, Paragraph, Bold, Italic, FormatPainter ],
			toolbar: [ 'undo', 'redo', '|', 'bold', 'italic', '|', 'formatPainter' ]
		};
	}
}
```

Without any content inside, the `<ckeditor-multi-root>` component renders the toolbar followed by the editables of all roots. When `config.menuBar.isVisible` is set to `true`, it renders the menu bar above the toolbar, too.

To build a custom layout, put the `<ckeditor-multi-root-toolbar>`, `<ckeditor-multi-root-menu-bar>`, and `<ckeditor-multi-root-editable>` components inside the `<ckeditor-multi-root>` component. The [npm guide](../../self-hosted/angular/angular-multiroot-npm.md#custom-layout) shows how.

<a id="component-api"></a>

## Component API

The component works the same regardless of the distribution. See the [npm guide](../../self-hosted/angular/angular-multiroot-npm.md) for:

* The [supported `@Input` properties](../../self-hosted/angular/angular-multiroot-npm.md#supported-input-properties).
* The [supported `@Output` properties](../../self-hosted/angular/angular-multiroot-npm.md#supported-output-properties).
* The [`addRoot()` and `removeRoot()` methods, and the `roots()` signal](../../self-hosted/angular/angular-multiroot-npm.md#component-api).
* [Two-way data binding](../../self-hosted/angular/angular-multiroot-npm.md#two-way-data-binding).

<a id="contributing-and-reporting-issues"></a>

## Contributing and reporting issues

The source code of rich text editor component for Angular is available on GitHub in <https://github.com/ckeditor/ckeditor5-angular>.

<a id="next-steps"></a>

## Next steps

* See how to manipulate the editor’s data in the [Getting and setting data](../../../setup/getting-and-setting-data.md) guide.
* Refer to further guides in the [setup section](../../../setup/configuration.md) to see how to customize your editor further.
* Check the [features category](../../../../features/index.md) to learn more about individual features.

---

Full index of the CKEditor 5 documentation: [llms.txt](../../../../../llms.txt)
