Skip to content

Commit

Permalink
Switched order of the sections to reflect the popularity of them.
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Jul 12, 2024
1 parent a3e86d1 commit cc1157b
Showing 1 changed file with 37 additions and 37 deletions.
74 changes: 37 additions & 37 deletions docs/getting-started/integrations/angular.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,39 +127,15 @@ npm install @ckeditor/ckeditor5-angular

The following setup differs depending on the type of component you use.

#### NGModule components

If you want to use NGModule components, add the `CKEditorModule` to the `imports` array. It will make the CKEditor 5 component available in your Angular application.

```ts
// app.module.ts

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { CKEditorModule } from '@ckeditor/ckeditor5-angular';

import { AppComponent } from './app.component';
#### Standalone components

@NgModule( {
declarations: [
AppComponent
],
imports: [
BrowserModule,
CKEditorModule
],
providers: [],
bootstrap: [ AppComponent ]
} )
export class AppModule { }
```
Standalone components provide a simplified way to build Angular applications. They are enabled in Angular 17 by default. Standalone components aim to simplify the setup and reduce the need for `NGModules`. That is why you do not need such a module in this case.

Then, import the editor in your Angular component and assign it to a `public` property to make it accessible from the template. The below example shows how to use the component with open-source and premium plugins.
Instead, add the `CKEditorModule` to the imports in your app component. The component needs the `standalone` option set to `true`.

```ts
// app.component.ts

import { Component } from '@angular/core';
import { CKEditorModule } from '@ckeditor/ckeditor5-angular';
import { ClassicEditor, Bold, Essentials, Italic, Mention, Paragraph, Undo } from 'ckeditor5';
import { SlashCommand } from 'ckeditor5-premium-features';

Expand All @@ -169,7 +145,8 @@ import 'ckeditor5-premium-features/ckeditor5-premium-features.css';
@Component( {
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: [ './app.component.css' ]
imports: [ CKEditorModule ],
standalone: true
} )
export class AppComponent {
title = 'angular';
Expand All @@ -188,23 +165,47 @@ export class AppComponent {
}
```

Finally, use the `<ckeditor>` tag in the template to run the rich text editor:
Then, use the `<ckeditor>` tag in the template to run the rich text editor:

```html
<!-- app.component.html -->

<ckeditor [editor]="Editor" [config]="config" data="<p>Hello, world!</p>"></ckeditor>
```

#### Standalone components
#### NGModule components

Standalone components provide a simplified way to build Angular applications. They are enabled in Angular 17 by default. Standalone components aim to simplify the setup and reduce the need for `NGModules`. That is why you do not need such a module in this case.
If you want to use NGModule components, add the `CKEditorModule` to the `imports` array. It will make the CKEditor&nbsp;5 component available in your Angular application.

Instead, add the `CKEditorModule` to the imports in your app component. The component needs the `standalone` option set to `true`.
```ts
// app.module.ts

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { CKEditorModule } from '@ckeditor/ckeditor5-angular';

import { AppComponent } from './app.component';

@NgModule( {
declarations: [
AppComponent
],
imports: [
BrowserModule,
CKEditorModule
],
providers: [],
bootstrap: [ AppComponent ]
} )
export class AppModule { }
```

Then, import the editor in your Angular component and assign it to a `public` property to make it accessible from the template. The below example shows how to use the component with open-source and premium plugins.

```ts
// app.component.ts

import { Component } from '@angular/core';
import { CKEditorModule } from '@ckeditor/ckeditor5-angular';
import { ClassicEditor, Bold, Essentials, Italic, Mention, Paragraph, Undo } from 'ckeditor5';
import { SlashCommand } from 'ckeditor5-premium-features';

Expand All @@ -214,8 +215,7 @@ import 'ckeditor5-premium-features/ckeditor5-premium-features.css';
@Component( {
selector: 'app-root',
templateUrl: './app.component.html',
imports: [ CKEditorModule ],
standalone: true
styleUrls: [ './app.component.css' ]
} )
export class AppComponent {
title = 'angular';
Expand All @@ -234,7 +234,7 @@ export class AppComponent {
}
```

Then, use the `<ckeditor>` tag in the template to run the rich text editor:
Finally, use the `<ckeditor>` tag in the template to run the rich text editor:

```html
<!-- app.component.html -->
Expand Down

0 comments on commit cc1157b

Please sign in to comment.