# Angular Installation

> Add the Editor42 WYSIWYG HTML editor to an Angular app with @editor42/editor42-angular, a drop-in replacement for @tinymce/tinymce-angular. No API key.

Source: https://editor42.com/docs/install/angular  
Section: Installation > Integrations > Angular  
Every page of editor42.com has a Markdown copy at its URL + `.md` (`index.md` after a URL that ends in `/`); all of them are in one file: https://editor42.com/llms-full.txt

`@editor42/editor42-angular` is a thin wrapper around Editor42 that makes it an Angular component. There is no account, no sign-up and no key of any kind.

## Install

```sh
npm install @editor42/editor42-angular
```

or for Yarn users:

```sh
yarn add @editor42/editor42-angular
```

## Basic Setup

The editor is a standalone component:

```ts
import { Component } from '@angular/core';
import { EditorComponent } from '@editor42/editor42-angular';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [ EditorComponent ],
  template: '<editor [init]="{ height: 400 }" initialValue="<p>Hello from Editor42</p>"></editor>'
})
export class AppComponent {}
```

With no extra inputs the editor script is loaded from `https://cdn.editor42.com` on the `latest` channel. That pointer only ever moves for security and bug-fix releases, because the Editor42 major version is fixed forever.

`EditorModule` is exported as well, for applications that are still organised in NgModules.

## Reading and Writing the Content

The component implements `ControlValueAccessor`, so it works with both forms APIs:

```ts
@Component({
  selector: 'app-root',
  standalone: true,
  imports: [ EditorComponent, FormsModule ],
  template: '<editor [(ngModel)]="content" [init]="{ height: 400 }"></editor>'
})
export class AppComponent {
  content = '<p>Hello from Editor42</p>';
}
```

## Self-Hosting

Provide the full script URL through dependency injection:

```ts
import { EDITOR42_SCRIPT_SRC } from '@editor42/editor42-angular';

providers: [
  { provide: EDITOR42_SCRIPT_SRC, useValue: '/js/editor42/editor42.min.js' }
]
```

## Pinning a Version

```html
<editor channel="42.0.1"></editor>
```

`channel` accepts `latest`, a `latest-N` alias, or an exact version.

## Editor Options

Everything else is an Editor42 option, passed through the init input:

```html
<editor [init]="{ height: 400, menubar: false, plugins: 'lists link' }"></editor>
```

See the [Configuration Options](https://editor42.com/api/configuration) for the full list.

## Migrating from @tinymce/tinymce-angular

```sh
npm uninstall @tinymce/tinymce-angular
npm install @editor42/editor42-angular
```

Change the import to `@editor42/editor42-angular` and you are done. Input, output and component names are unchanged. The `TINYMCE_SCRIPT_SRC` injection token still works as a deprecated alias of `EDITOR42_SCRIPT_SRC` (the Editor42 token wins when both are provided), and `cloudChannel` remains as a deprecated alias of `channel`.

All API-key and licence-key handling has been removed. The corresponding inputs are still accepted so existing code compiles, but they do nothing: no key is read, stored or sent anywhere, and no request ever reaches a vendor cloud.

The component also drives a stock TinyMCE if that is what is already loaded on the page, which keeps the switch reversible.

See the [migration guide](https://editor42.com/docs/migration/from-tinymce) for the editor side of the move.

## Live Demo

See it running, with its full source: the [Angular demo](https://editor42.com/examples/angular).

## Links

- NPM: [`@editor42/editor42-angular`](https://www.npmjs.com/package/@editor42/editor42-angular)
- GitHub: [editor42com/editor42-angular](https://github.com/editor42com/editor42-angular)
