Skip to content

Commit 70bc41f

Browse files
Merge pull request #24575 from abpframework/documentation/angular-version-upgrade-to-v21
Angular - Docs version upgrade to v21
2 parents c805596 + f22335d commit 70bc41f

File tree

7 files changed

+61
-70
lines changed

7 files changed

+61
-70
lines changed

docs/en/framework/ui/angular/checkbox-component.md

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,21 @@ The ABP Checkbox Component is a reusable form input component for the checkbox t
2525

2626
# Usage
2727

28-
The ABP Checkbox component is a part of the `ThemeSharedModule` module. If you've imported that module into your module, there's no need to import it again. If not, then first import it as shown below:
28+
The ABP Checkbox component (`AbpCheckboxComponent`) is a standalone component. You can import it directly in your component:
2929

3030
```ts
31-
// my-feature.module.ts
32-
33-
import { ThemeSharedModule } from "@abp/ng.theme.shared";
34-
import { CheckboxDemoComponent } from "./CheckboxDemoComponent.component";
35-
36-
@NgModule({
37-
imports: [
38-
ThemeSharedModule,
39-
// ...
40-
],
41-
declarations: [CheckboxDemoComponent],
42-
// ...
31+
import { Component } from "@angular/core";
32+
import { AbpCheckboxComponent } from "@abp/ng.theme.shared";
33+
34+
@Component({
35+
selector: 'app-checkbox-demo',
36+
imports: [AbpCheckboxComponent],
37+
templateUrl: './checkbox-demo.component.html',
4338
})
44-
export class MyFeatureModule {}
39+
export class CheckboxDemoComponent {}
4540
```
4641

47-
Then, the `abp-checkbox` component can be used. See the example below:
42+
Then, the `abp-checkbox` component can be used in your template. See the example below:
4843

4944
```html
5045
<div class="form-check">

docs/en/framework/ui/angular/form-input-component.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,21 @@ The ABP FormInput Component is a reusable form input component for the text type
2222

2323
# Usage
2424

25-
The ABP FormInput component is a part of the `ThemeSharedModule` module. If you've imported that module into your module, there's no need to import it again. If not, then first import it as shown below:
25+
The ABP FormInput component (`AbpFormInputComponent`) is a standalone component. You can import it directly in your component:
2626

2727
```ts
28-
import { ThemeSharedModule } from "@abp/ng.theme.shared";
29-
import { FormInputDemoComponent } from "./FomrInputDemoComponent.component";
30-
31-
@NgModule({
32-
imports: [
33-
ThemeSharedModule,
34-
// ...
35-
],
36-
declarations: [FormInputDemoComponent],
28+
import { Component } from "@angular/core";
29+
import { AbpFormInputComponent } from "@abp/ng.theme.shared";
30+
31+
@Component({
32+
selector: 'app-form-input-demo',
33+
imports: [AbpFormInputComponent],
34+
templateUrl: './form-input-demo.component.html',
3735
})
38-
export class MyFeatureModule {}
36+
export class FormInputDemoComponent {}
3937
```
4038

41-
Then, the `abp-form-input` component can be used. See the example below:
39+
Then, the `abp-form-input` component can be used in your template. See the example below:
4240

4341
```html
4442
<div class="row">

docs/en/framework/ui/angular/form-validation.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@ import { NgxValidateCoreModule } from '@ngx-validate/core';
303303
@Component({
304304
selector: 'app-nested-form',
305305
templateUrl: './nested-form.component.html',
306-
standalone: true,
307306
imports: [NgxValidateCoreModule],
308307
})
309308
export class NestedFormComponent implements OnInit {

docs/en/framework/ui/angular/how-replaceable-components-work-with-extensions.md

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,45 @@
99

1010
Additional UI extensibility points ([Entity action extensions](../angular/entity-action-extensions.md), [data table column extensions](../angular/data-table-column-extensions.md), [page toolbar extensions](../angular/page-toolbar-extensions.md) and others) are used in ABP pages to allow to control entity actions, table columns and page toolbar of a page. If you replace a page, you need to apply some configurations to be able to work extension components in your component. Let's see how to do this by replacing the roles page.
1111

12-
Create a new module called `MyRolesModule`:
13-
14-
```bash
15-
yarn ng generate module my-roles --module app
16-
```
17-
1812
Create a new component called `MyRolesComponent`:
1913

2014
```bash
21-
yarn ng generate component my-roles/my-roles --flat --export
15+
yarn ng generate component my-roles/my-roles --flat
2216
```
2317

2418
Open the generated `src/app/my-roles/my-roles.component.ts` file and replace its content with the following:
2519

2620
```js
2721
import { Component, Injector, inject, OnInit } from '@angular/core';
28-
import { FormGroup } from '@angular/forms';
22+
import { FormGroup, ReactiveFormsModule } from '@angular/forms';
2923
import { finalize } from 'rxjs/operators';
3024

31-
import { ListService, PagedAndSortedResultRequestDto, PagedResultDto } from '@abp/ng.core';
25+
import { ListService, PagedAndSortedResultRequestDto, PagedResultDto, LocalizationPipe } from '@abp/ng.core';
3226
import { eIdentityComponents, RolesComponent } from '@abp/ng.identity';
3327
import { IdentityRoleDto, IdentityRoleService } from '@abp/ng.identity/proxy';
34-
import { ePermissionManagementComponents } from '@abp/ng.permission-management';
35-
import { Confirmation, ConfirmationService } from '@abp/ng.theme.shared';
28+
import { ePermissionManagementComponents, PermissionManagementComponent } from '@abp/ng.permission-management';
29+
import { Confirmation, ConfirmationService, ModalComponent, ButtonComponent } from '@abp/ng.theme.shared';
3630
import {
3731
EXTENSIONS_IDENTIFIER,
3832
FormPropData,
39-
generateFormFromProps
33+
generateFormFromProps,
34+
PageToolbarComponent,
35+
ExtensibleTableComponent,
36+
ExtensibleFormComponent
4037
} from '@abp/ng.components/extensible';
4138

4239
@Component({
4340
selector: 'app-my-roles',
41+
imports: [
42+
ReactiveFormsModule,
43+
LocalizationPipe,
44+
ModalComponent,
45+
ButtonComponent,
46+
PageToolbarComponent,
47+
ExtensibleTableComponent,
48+
ExtensibleFormComponent,
49+
PermissionManagementComponent
50+
],
4451
templateUrl: './my-roles.component.html',
4552
providers: [
4653
ListService,
@@ -236,25 +243,12 @@ Open the generated `src/app/my-role/my-role.component.html` file and replace its
236243

237244
We have added the `abp-page-toolbar`, `abp-extensible-table`, and `abp-extensible-form` extension components to template of the `MyRolesComponent`.
238245

239-
You should import the required modules for the `MyRolesComponent` to `MyRolesModule`. Open the `src/my-roles/my-roles.module.ts` file and replace the content with the following:
240-
241-
```js
242-
import { ExtensibleModule } from '@abp/ng.components/extensible';
243-
import { NgModule } from '@angular/core';
244-
import { SharedModule } from '../shared/shared.module';
245-
import { MyRolesComponent } from './my-roles.component';
246-
import { PermissionManagementModule } from '@abp/ng.permission-management';
247-
248-
@NgModule({
249-
declarations: [MyRolesComponent],
250-
imports: [SharedModule, ExtensibleModule, PermissionManagementModule],
251-
exports: [MyRolesComponent],
252-
})
253-
export class MyRolesModule {}
254-
```
255-
256-
- `ExtensionsModule` imported to be able to use the extension components in your component.
257-
- `PermissionManagementModule` imported to be able to use the `abp-permission-*management` in your component.
246+
Since we are using standalone components, all required imports are already defined in the component's `imports` array:
247+
- `PageToolbarComponent`, `ExtensibleTableComponent`, `ExtensibleFormComponent` - Extension components
248+
- `PermissionManagementComponent` - Permission management component
249+
- `ModalComponent`, `ButtonComponent` - Theme shared components
250+
- `LocalizationPipe` - For localization
251+
- `ReactiveFormsModule` - For form handling
258252

259253
As the last step, it is needs to be replaced the `RolesComponent` with the `MyRolesComponent`. Open the `app.component.ts` and modify its content as shown below:
260254

docs/en/framework/ui/angular/quick-start.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
```json
22
//[doc-seo]
33
{
4-
"Description": "Learn how to set up your development environment for ABP Angular 17.3.x with this quick start guide, ensuring a smooth development experience."
4+
"Description": "Learn how to set up your development environment for ABP Angular 21.x with this quick start guide, ensuring a smooth development experience."
55
}
66
```
77

88
# ABP Angular Quick Start
99

10-
**In this version ABP uses Angular [20.0.x](https://github.com/angular/angular/tree/20.0.x) version. You don't have to install Angular CLI globally**
10+
**In this version ABP uses Angular [21.0.x](https://github.com/angular/angular/tree/21.0.x) version. You don't have to install Angular CLI globally**
1111

1212
## How to Prepare Development Environment
1313

@@ -18,13 +18,13 @@ Please follow the steps below to prepare your development environment for Angula
1818
3. **[Optional] Install VS Code:** [VS Code](https://code.visualstudio.com/) is a free, open-source IDE which works seamlessly with TypeScript. Although you can use any IDE including Visual Studio or Rider, VS Code will most likely deliver the best developer experience when it comes to Angular projects. ABP project templates even contain plugin recommendations for VS Code users, which VS Code will ask you to install when you open the Angular project folder. Here is a list of recommended extensions:
1919
- [Angular Language Service](https://marketplace.visualstudio.com/items?itemName=angular.ng-template)
2020
- [Prettier - Code formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
21-
- [TSLint](https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-typescript-tslint-plugin)
21+
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
2222
- [Visual Studio IntelliCode](https://marketplace.visualstudio.com/items?itemName=visualstudioexptteam.vscodeintellicode)
2323
- [Path Intellisense](https://marketplace.visualstudio.com/items?itemName=christian-kohler.path-intellisense)
2424
- [npm Intellisense](https://marketplace.visualstudio.com/items?itemName=christian-kohler.npm-intellisense)
2525
- [Angular 10 Snippets - TypeScript, Html, Angular Material, ngRx, RxJS & Flex Layout](https://marketplace.visualstudio.com/items?itemName=Mikael.Angular-BeastCode)
2626
- [JavaScript (ES6) code snippets](https://marketplace.visualstudio.com/items?itemName=xabikos.JavaScriptSnippets)
27-
- [Debugger for Chrome](https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome)
27+
- [JavaScript Debugger](https://marketplace.visualstudio.com/items?itemName=ms-vscode.js-debug) (built-in, usually pre-installed)
2828
- [Git History](https://marketplace.visualstudio.com/items?itemName=donjayamanne.githistory)
2929
- [indent-rainbow](https://marketplace.visualstudio.com/items?itemName=oderwat.indent-rainbow)
3030

docs/en/framework/ui/angular/ssr-configuration.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ The schematic installs `openid-client` to handle authentication on the server si
239239
240240
## 5. Render Modes & Hybrid Rendering
241241

242-
Angular 20 provides different rendering modes that you can configure per route in the `app.routes.server.ts` file to optimize performance and SEO.
242+
Angular 21 provides different rendering modes that you can configure per route in the `app.routes.server.ts` file to optimize performance and SEO.
243243

244244
### 5.1. Available Render Modes
245245

@@ -352,13 +352,17 @@ currentTime = new Date();
352352
// ✅ Good - use TransferState for consistent data
353353
import { TransferState, makeStateKey } from '@angular/core';
354354

355-
const TIME_KEY = makeStateKey<string>('time');
355+
TIME_KEY = makeStateKey<string>('time');
356+
transferState = inject<TransferState>(TransferState);
357+
time: string;
356358

357-
constructor(private transferState: TransferState) {
359+
constructor() {
358360
if (isPlatformServer(this.platformId)) {
359-
this.transferState.set(TIME_KEY, new Date().toISOString());
361+
this.time = new Date().toISOString();
362+
this.transferState.set(this.TIME_KEY, this.time);
360363
} else {
361-
this.time = this.transferState.get(TIME_KEY, new Date().toISOString());
364+
const timeFromCache = this.transferState.get(this.TIME_KEY, new Date().toISOString());
365+
this.time = timeFromCache;
362366
}
363367
}
364368
```

docs/en/framework/ui/angular/theming.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,13 +229,14 @@ All of the options are shown below. You can choose either of them.
229229

230230
````ts
231231
import { eUserMenuItems } from '@abp/ng.theme.basic';
232-
import { UserMenuService } from '@abp/ng.theme.shared';
232+
import { UserMenuService, UserMenu } from '@abp/ng.theme.shared';
233+
import { LocalizationPipe, INJECTOR_PIPE_DATA_TOKEN } from '@abp/ng.core';
233234
import { Component, inject } from '@angular/core';
234235
import { Router } from '@angular/router';
235236

236-
// make sure that you import this component in a NgModule
237237
@Component({
238238
selector: 'abp-current-user-test',
239+
imports: [LocalizationPipe],
239240
template: `
240241
<a class="dropdown-item pointer" (click)="data.action()">
241242
@if (data.textTemplate.icon){

0 commit comments

Comments
 (0)