Skip to content

Commit 23952c4

Browse files
authored
33092 devreal build content listing pages with search and filtering (#33132)
### Proposed Changes This pull request updates the Angular example application to support Angular 20 and modernizes its configuration, dependencies, and component structure. Key changes include upgrading Angular dependencies, switching to the new Angular build system, removing the `standalone: true` flag from components, and simplifying the blog listing page logic. **Angular and Build System Upgrades:** * Upgraded all Angular dependencies and devDependencies in `package.json` to version 20.x, replaced `@angular-devkit/build-angular` with `@angular/build`, and updated `typescript` and `zone.js` versions. [[1]](diffhunk://#diff-29e39f0f27030a04db32af364f291f38a2c3905dc74a198da96ac1832d2d1548L13-R32) [[2]](diffhunk://#diff-29e39f0f27030a04db32af364f291f38a2c3905dc74a198da96ac1832d2d1548L44-R44) * Updated `angular.json` to use the new Angular build system builders (`@angular/build:application`, `@angular/build:dev-server`, etc.) and added `schematics` and `cli.analytics` configuration. [[1]](diffhunk://#diff-eec3f95f99e909a2e87a975d8c58e12823c5b60e6637f5ccb0a72303c4a8e627L14-R14) [[2]](diffhunk://#diff-eec3f95f99e909a2e87a975d8c58e12823c5b60e6637f5ccb0a72303c4a8e627L62-R62) [[3]](diffhunk://#diff-eec3f95f99e909a2e87a975d8c58e12823c5b60e6637f5ccb0a72303c4a8e627L77-R83) [[4]](diffhunk://#diff-eec3f95f99e909a2e87a975d8c58e12823c5b60e6637f5ccb0a72303c4a8e627R102-R130) **Component Structure and Code Simplification:** * Removed the `standalone: true` flag from all components, reverting to the traditional NgModule-based approach. [[1]](diffhunk://#diff-2725d85091bfb53a2b930e60ca71bf0e99f896c5833acf86b035bcb070ea624dL6) [[2]](diffhunk://#diff-63b433b9d03e786471e7d6108e15f86c5b2a190c018001c7dee7ac281d5195a2L8) [[3]](diffhunk://#diff-3564e0de618195aef98741547bf17eeb006bd36a626a3b0903adabe63f3855ebL7) [[4]](diffhunk://#diff-c28b5e34652734bbffe79d19692542393955e512f424fbd91f325997b80d4782L10) [[5]](diffhunk://#diff-070e07ebff248058d74b24b9c7f3fd8b4beaf315c8507357d2367e788d17d31bL7) [[6]](diffhunk://#diff-481074a9594708861b3b3c1c4c2ea89f2a5619542b7d1c4d8758a2190364f765L13) [[7]](diffhunk://#diff-8b671f2979ce1089d87632d4f6e67b7c67a538b71253a404d30d51205eab9722L20) [[8]](diffhunk://#diff-a46a550077645e0a89357d19e4373ca58e38835f0a56aa7a0861652b6c98798eL8-R11) [[9]](diffhunk://#diff-cd1f41fdf8bc1ca6879d6074add62d242d22f269a4e36920376626d69fd2b1eaL9) [[10]](diffhunk://#diff-14f032a50b6dceb08005ace27c1922b2f7dfd58c8febdeddde3794d9e1960b1eL8) [[11]](diffhunk://#diff-fe9343e9b19c638513e5bfc051388a5b56d90695878c8a5853316d305eb48039L9) [[12]](diffhunk://#diff-56e103c0f7448653af542d52b1b93705d2034c70a0205241f758b8a19a7cb69eL10) [[13]](diffhunk://#diff-b516b4b6232e7f968624b04cb94cdd8e27814f38458b3e0071b6c1e543cee147L11-R16) [[14]](diffhunk://#diff-c3e544da8f3e2fd565610871a05740024af320673950dc09095accc0da3f7fe0L14) * Updated Angular templates to use self-closing tags and simplified structural directive usage for better readability and Angular 20 compatibility. [[1]](diffhunk://#diff-e6df2c6c111268b2b2bf0e0122e7d8ac557d56d39c117ef11a7f5a9e4d80d043L1-R11) [[2]](diffhunk://#diff-e6df2c6c111268b2b2bf0e0122e7d8ac557d56d39c117ef11a7f5a9e4d80d043L23-R30) [[3]](diffhunk://#diff-e6df2c6c111268b2b2bf0e0122e7d8ac557d56d39c117ef11a7f5a9e4d80d043L47-R48) [[4]](diffhunk://#diff-09f57e428397628569a25c5517a79be34d72b8697a8a871f6a235c738d0cfe51L12-R12) [[5]](diffhunk://#diff-b516b4b6232e7f968624b04cb94cdd8e27814f38458b3e0071b6c1e543cee147L11-R16) [[6]](diffhunk://#diff-a46a550077645e0a89357d19e4373ca58e38835f0a56aa7a0861652b6c98798eL8-R11) **Blog Listing Page Refactor:** * Refactored `blog-listing.component.ts` to remove unused imports and debounce logic, switched to a constant for blog query limits, and simplified state management and filtering logic. [[1]](diffhunk://#diff-eb540efb3bbe27cbacbca2ce8db82b58633a9f5ec5079f5b4651483b73999eaaL1-R1) [[2]](diffhunk://#diff-eb540efb3bbe27cbacbca2ce8db82b58633a9f5ec5079f5b4651483b73999eaaL14-L46) [[3]](diffhunk://#diff-eb540efb3bbe27cbacbca2ce8db82b58633a9f5ec5079f5b4651483b73999eaaL58-L63) [[4]](diffhunk://#diff-eb540efb3bbe27cbacbca2ce8db82b58633a9f5ec5079f5b4651483b73999eaaL75-L99) [[5]](diffhunk://#diff-eb540efb3bbe27cbacbca2ce8db82b58633a9f5ec5079f5b4651483b73999eaaL118-R91) * Updated the blog listing template for improved clarity and compatibility with Angular 20. [[1]](diffhunk://#diff-e6df2c6c111268b2b2bf0e0122e7d8ac557d56d39c117ef11a7f5a9e4d80d043L1-R11) [[2]](diffhunk://#diff-e6df2c6c111268b2b2bf0e0122e7d8ac557d56d39c117ef11a7f5a9e4d80d043L23-R30) [[3]](diffhunk://#diff-e6df2c6c111268b2b2bf0e0122e7d8ac557d56d39c117ef11a7f5a9e4d80d043L47-R48) These changes modernize the Angular example, align it with Angular 20 best practices, and improve maintainability and clarity. ### Checklist - [ ] Tests - [ ] Translations - [ ] Security Implications Contemplated (add notes if applicable) This PR fixes: #33092 <img width="1044" height="920" alt="Screenshot 2025-08-29 at 10 55 09 AM" src="https://github.com/user-attachments/assets/f63d437a-83f2-42fb-a14a-16aff03d763f" />
1 parent 871d2c8 commit 23952c4

File tree

65 files changed

+2008
-1808
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2008
-1808
lines changed

examples/angular/README.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Before you begin, ensure you have the following:
3333
You can get the code in two ways:
3434

3535
1. Direct download:
36+
3637
```
3738
https://github.com/dotCMS/core/tree/main/examples/angular
3839
```
@@ -60,8 +61,8 @@ To configure the Angular app to use your dotCMS instance:
6061
```typescript
6162
export const environment = {
6263
production: false,
63-
authToken: 'YOUR_AUTH_TOKEN_HERE',
64-
dotcmsUrl: 'https://demo.dotcms.com',
64+
authToken: "YOUR_AUTH_TOKEN_HERE",
65+
dotcmsUrl: "https://demo.dotcms.com",
6566
};
6667
```
6768

@@ -96,7 +97,7 @@ Note: When accessing `localhost:4200/about`, ensure that the `/about` page exist
9697
│ └── services
9798
└── shared/
9899
└── contentlets-wrapper/
99-
└── contentlet/
100+
└── contentlet/
100101
```
101102

102103
- `content-types/`: Components for rendering specific dotCMS content types
@@ -108,6 +109,7 @@ Note: When accessing `localhost:4200/about`, ensure that the `/about` page exist
108109
## Key Features
109110

110111
### How dotCMS Routes Pages
112+
111113
dotCMS allows a single page to be accessed via multiple URL paths (e.g., / and /index for the same "Home" page). This flexibility means your Angular application needs to handle these variations.
112114

113115
To ensure all paths to the same content are properly managed and to prevent 404/500 errors, we recommend using a catch-all route strategy in Angular.
@@ -158,7 +160,8 @@ If you encounter issues while setting up or running the dotCMS Angular example,
158160

159161
This often occurs when the environment variables are not set correctly.
160162

161-
**Solution:**
163+
**Solution:**
164+
162165
- Double-check that you've updated the `authToken` in `src/environments/environment.development.ts` with a valid token.
163166
- Ensure the token has the necessary permissions (at least read access) for the content you're trying to fetch.
164167
- Verify that the token hasn't expired. If it has, generate a new one in the dotCMS UI.
@@ -170,6 +173,7 @@ This often occurs when the environment variables are not set correctly.
170173
If you're having trouble connecting to the dotCMS instance:
171174

172175
**Solution:**
176+
173177
- Verify that the `dotcmsUrl` in `src/environments/environment.development.ts` is correct.
174178
- Check if you can access the dotCMS instance directly through a web browser.
175179
- If using `https://demo.dotcms.com`, remember it restarts every 24 hours. You might need to wait or try again later.
@@ -182,6 +186,7 @@ If you're having trouble connecting to the dotCMS instance:
182186
If you're getting 404 errors for pages that should exist:
183187

184188
**Solution:**
189+
185190
- Ensure the page exists in your dotCMS instance. For example, if you're trying to access `/about`, make sure an "about" page exists in dotCMS.
186191
- Check if the content types used in the example match those in your dotCMS instance.
187192
- Verify that the content has been published and is not in draft status.
@@ -193,18 +198,23 @@ If you're getting 404 errors for pages that should exist:
193198
If you're experiencing unexpected behavior or errors related to dependencies:
194199

195200
**Solution:** Perform a clean reinstall of all dependencies by running:
201+
196202
```bash
197203
rm -rf node_modules && rm package-lock.json && npm install
198204
```
205+
199206
This command will:
207+
200208
1. Remove the `node_modules` directory
201209
2. Delete the `package-lock.json` file
202210
3. Perform a fresh install of all dependencies
203211

204212
After this, restart your development server:
213+
205214
```bash
206215
ng serve
207216
```
217+
208218
</details>
209219

210220
<details>
@@ -213,17 +223,21 @@ ng serve
213223
If you're experiencing build errors or changes aren't reflected in the running application:
214224

215225
**Solution:** Clear the Angular build cache and rebuild the project:
226+
216227
```bash
217228
ng cache clean
218229
ng build --configuration=development
219230
ng serve
220231
```
232+
221233
This sequence of commands will:
234+
222235
1. Clear the Angular build cache
223236
2. Rebuild the project with development configuration
224237
3. Start the development server
225238

226239
This is recommended when:
240+
227241
- You've made significant changes to your project configuration
228242
- You're experiencing unexplainable build errors
229243
- Your changes aren't reflected in the running application despite saving and restarting the dev server
@@ -236,6 +250,7 @@ This is recommended when:
236250
If the Universal Visual Editor is not functioning as expected:
237251

238252
**Solution:**
253+
239254
- Ensure you've correctly configured the UVE in your dotCMS instance as described in the [Universal Visual Editor](#universal-visual-editor) section.
240255
- Verify that your Angular application is running on `http://localhost:4200` (or update the UVE configuration if using a different port).
241256
- Check that you're accessing the dotCMS edit mode from the correct URL.
@@ -250,4 +265,4 @@ If you continue to experience issues after trying these solutions, please check
250265
- [dotCMS Documentation](https://dotcms.com/docs/)
251266
- [dotCMS REST API Authentication](https://auth.dotcms.com/docs/latest/rest-api-authentication)
252267

253-
For more assistance with Angular, use `ng help` or visit the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
268+
For more assistance with Angular, use `ng help` or visit the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.

examples/angular/angular.json

Lines changed: 40 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,15 @@
1111
"prefix": "app",
1212
"architect": {
1313
"build": {
14-
"builder": "@angular-devkit/build-angular:application",
14+
"builder": "@angular/build:application",
1515
"options": {
1616
"outputPath": "dist/angular",
1717
"index": "src/index.html",
1818
"browser": "src/main.ts",
19-
"polyfills": [
20-
"zone.js"
21-
],
19+
"polyfills": ["zone.js"],
2220
"tsConfig": "tsconfig.app.json",
23-
"assets": [
24-
"src/favicon.ico",
25-
"src/assets"
26-
],
27-
"styles": [
28-
"src/styles.css"
29-
]
21+
"assets": ["src/favicon.ico", "src/assets"],
22+
"styles": ["src/styles.css"]
3023
},
3124
"configurations": {
3225
"production": {
@@ -59,9 +52,9 @@
5952
"defaultConfiguration": "production"
6053
},
6154
"serve": {
62-
"builder": "@angular-devkit/build-angular:dev-server",
55+
"builder": "@angular/build:dev-server",
6356
"options": {
64-
"proxyConfig": "./proxy.conf.json"
57+
"proxyConfig": "./proxy.conf.json"
6558
},
6659
"configurations": {
6760
"production": {
@@ -74,30 +67,51 @@
7467
"defaultConfiguration": "development"
7568
},
7669
"extract-i18n": {
77-
"builder": "@angular-devkit/build-angular:extract-i18n",
70+
"builder": "@angular/build:extract-i18n",
7871
"options": {
7972
"buildTarget": "angular:build"
8073
}
8174
},
8275
"test": {
83-
"builder": "@angular-devkit/build-angular:karma",
76+
"builder": "@angular/build:karma",
8477
"options": {
85-
"polyfills": [
86-
"zone.js",
87-
"zone.js/testing"
88-
],
78+
"polyfills": ["zone.js", "zone.js/testing"],
8979
"tsConfig": "tsconfig.spec.json",
90-
"assets": [
91-
"src/favicon.ico",
92-
"src/assets"
93-
],
94-
"styles": [
95-
"src/styles.css"
96-
],
80+
"assets": ["src/favicon.ico", "src/assets"],
81+
"styles": ["src/styles.css"],
9782
"scripts": []
9883
}
9984
}
10085
}
10186
}
87+
},
88+
"schematics": {
89+
"@schematics/angular:component": {
90+
"type": "component"
91+
},
92+
"@schematics/angular:directive": {
93+
"type": "directive"
94+
},
95+
"@schematics/angular:service": {
96+
"type": "service"
97+
},
98+
"@schematics/angular:guard": {
99+
"typeSeparator": "."
100+
},
101+
"@schematics/angular:interceptor": {
102+
"typeSeparator": "."
103+
},
104+
"@schematics/angular:module": {
105+
"typeSeparator": "."
106+
},
107+
"@schematics/angular:pipe": {
108+
"typeSeparator": "."
109+
},
110+
"@schematics/angular:resolver": {
111+
"typeSeparator": "."
112+
}
113+
},
114+
"cli": {
115+
"analytics": "0edec4ee-1cae-4e3b-9f4f-8961fece817a"
102116
}
103117
}

examples/angular/package.json

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
11
{
2-
"name": "angular",
3-
"version": "0.0.0",
4-
"scripts": {
5-
"ng": "ng",
6-
"start": "ng serve",
7-
"build": "ng build",
8-
"watch": "ng build --watch --configuration development",
9-
"test": "ng test"
10-
},
11-
"private": true,
12-
"dependencies": {
13-
"@angular/animations": "^17.1.0",
14-
"@angular/common": "^17.1.0",
15-
"@angular/compiler": "^17.1.0",
16-
"@angular/core": "^17.1.0",
17-
"@angular/forms": "^17.1.0",
18-
"@angular/platform-browser": "^17.1.0",
19-
"@angular/platform-browser-dynamic": "^17.1.0",
20-
"@angular/router": "^17.1.0",
21-
"@dotcms/angular": "latest",
22-
"@dotcms/client": "latest",
23-
"@dotcms/types": "latest",
24-
"@dotcms/uve": "latest",
25-
"rxjs": "~7.8.0",
26-
"tslib": "^2.3.0",
27-
"zone.js": "~0.14.2"
28-
},
29-
"devDependencies": {
30-
"@angular-devkit/build-angular": "^17.0.7",
31-
"@angular/cli": "^17.0.7",
32-
"@angular/compiler-cli": "^17.1.0",
33-
"@tailwindcss/typography": "^0.5.16",
34-
"@types/jasmine": "~5.1.0",
35-
"autoprefixer": "^10.4.19",
36-
"jasmine-core": "~5.1.0",
37-
"karma": "~6.4.0",
38-
"karma-chrome-launcher": "~3.2.0",
39-
"karma-coverage": "~2.2.0",
40-
"karma-jasmine": "~5.1.0",
41-
"karma-jasmine-html-reporter": "~2.1.0",
42-
"postcss": "^8.4.38",
43-
"tailwindcss": "^3.4.3",
44-
"typescript": "~5.2.2"
45-
}
2+
"name": "angular",
3+
"version": "0.0.0",
4+
"scripts": {
5+
"ng": "ng",
6+
"start": "ng serve",
7+
"build": "ng build",
8+
"watch": "ng build --watch --configuration development",
9+
"test": "ng test"
10+
},
11+
"private": true,
12+
"dependencies": {
13+
"@angular/animations": "^20.2.2",
14+
"@angular/common": "^20.2.2",
15+
"@angular/compiler": "^20.2.2",
16+
"@angular/core": "^20.2.2",
17+
"@angular/forms": "^20.2.2",
18+
"@angular/platform-browser": "^20.2.2",
19+
"@angular/platform-browser-dynamic": "^20.2.2",
20+
"@angular/router": "^20.2.2",
21+
"@dotcms/angular": "latest",
22+
"@dotcms/client": "latest",
23+
"@dotcms/types": "latest",
24+
"@dotcms/uve": "latest",
25+
"rxjs": "~7.8.0",
26+
"tslib": "^2.3.0",
27+
"zone.js": "~0.15.1"
28+
},
29+
"devDependencies": {
30+
"@angular/build": "^20.2.1",
31+
"@angular/cli": "^20.2.1",
32+
"@angular/compiler-cli": "^20.2.2",
33+
"@tailwindcss/typography": "^0.5.16",
34+
"@types/jasmine": "~5.1.0",
35+
"autoprefixer": "^10.4.19",
36+
"jasmine-core": "~5.1.0",
37+
"karma": "~6.4.0",
38+
"karma-chrome-launcher": "~3.2.0",
39+
"karma-coverage": "~2.2.0",
40+
"karma-jasmine": "~5.1.0",
41+
"karma-jasmine-html-reporter": "~2.1.0",
42+
"postcss": "^8.4.38",
43+
"tailwindcss": "^3.4.3",
44+
"typescript": "~5.9.2"
45+
}
4646
}

examples/angular/proxy.conf.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"/api": {
3-
"target": "http://localhost:8080",
4-
"secure": false
5-
},
6-
"/dA": {
7-
"target": "http://localhost:8080",
8-
"secure": false
9-
}
2+
"/api": {
3+
"target": "http://localhost:8080",
4+
"secure": false
5+
},
6+
"/dA": {
7+
"target": "http://localhost:8080",
8+
"secure": false
9+
}
1010
}

examples/angular/src/app/app.component.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import { Component } from '@angular/core';
22
import { RouterOutlet } from '@angular/router';
33

44
@Component({
5-
selector: 'app-root',
6-
standalone: true,
7-
imports: [RouterOutlet],
8-
template: '<router-outlet />'
5+
selector: 'app-root',
6+
imports: [RouterOutlet],
7+
template: '<router-outlet />',
98
})
109
export class AppComponent {}

0 commit comments

Comments
 (0)