Skip to content

Commit 3054031

Browse files
committed
feat: convert demo app to Angular 19 standalone architecture
- Convert from NgModule to standalone component architecture - Update main.ts to use bootstrapApplication with providers - Create app.routes.ts for lazy-loaded routing - Convert all demo components to standalone with proper imports - Fix angular.json configuration (browserTarget -> buildTarget) - Replace deprecated @angular/flex-layout with CSS Flexbox - Add comprehensive flex-layout.scss replacement - Update all component templates to use CSS classes - Fix HTTP interceptor configuration with withInterceptorsFromDi() - Add missing Angular Material modules - Convert form field placeholders to proper mat-label elements - Fix toolbar button icon alignment with MDI icons - Remove unused imports and fix lint warnings
1 parent dff5043 commit 3054031

24 files changed

+556
-307
lines changed

.eslintrc.json

Lines changed: 0 additions & 53 deletions
This file was deleted.

angular.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,18 @@
7373
"builder": "@angular-devkit/build-angular:dev-server",
7474
"configurations": {
7575
"production": {
76-
"browserTarget": "ngx-ui-loader-app:build:production"
76+
"buildTarget": "ngx-ui-loader-app:build:production"
7777
},
7878
"development": {
79-
"browserTarget": "ngx-ui-loader-app:build:development"
79+
"buildTarget": "ngx-ui-loader-app:build:development"
8080
}
8181
},
8282
"defaultConfiguration": "development"
8383
},
8484
"extract-i18n": {
8585
"builder": "@angular-devkit/build-angular:extract-i18n",
8686
"options": {
87-
"browserTarget": "ngx-ui-loader-app:build"
87+
"buildTarget": "ngx-ui-loader-app:build"
8888
}
8989
},
9090
"test": {

eslint.config.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import tseslint from '@typescript-eslint/eslint-plugin';
2+
import tsparser from '@typescript-eslint/parser';
3+
import angular from '@angular-eslint/eslint-plugin';
4+
import angularTemplate from '@angular-eslint/eslint-plugin-template';
5+
import angularTemplateParser from '@angular-eslint/template-parser';
6+
7+
export default [
8+
{
9+
ignores: ['dist/**/*', 'node_modules/**/*'],
10+
},
11+
{
12+
files: ['**/*.ts'],
13+
languageOptions: {
14+
parser: tsparser,
15+
parserOptions: {
16+
project: ['tsconfig.json'],
17+
createDefaultProgram: true,
18+
},
19+
},
20+
plugins: {
21+
'@typescript-eslint': tseslint,
22+
'@angular-eslint': angular,
23+
},
24+
rules: {
25+
...tseslint.configs.recommended.rules,
26+
...angular.configs.recommended.rules,
27+
'@angular-eslint/directive-selector': [
28+
'error',
29+
{
30+
type: 'attribute',
31+
prefix: 'app',
32+
style: 'camelCase',
33+
},
34+
],
35+
'@angular-eslint/component-selector': [
36+
'error',
37+
{
38+
type: 'element',
39+
prefix: 'app',
40+
style: 'kebab-case',
41+
},
42+
],
43+
'@typescript-eslint/no-unused-vars': 'warn',
44+
'@typescript-eslint/no-explicit-any': 'warn',
45+
},
46+
},
47+
{
48+
files: ['**/*.html'],
49+
languageOptions: {
50+
parser: angularTemplateParser,
51+
},
52+
plugins: {
53+
'@angular-eslint/template': angularTemplate,
54+
},
55+
rules: {
56+
...angularTemplate.configs.recommended.rules,
57+
},
58+
},
59+
];

src/app/app.component.html

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,35 +24,19 @@
2424

2525
<div ngxUiLoaderBlurred [blur]="demoService.config.blur">
2626
<mat-toolbar color="primary">
27-
<span>
28-
<a mat-button href="https://tdev.app/ngx-ui-loader">
29-
<mat-icon
30-
fontIcon="mdi-book-open-page-variant"
31-
fontSet="mdi"
32-
class="mdi-24px"
33-
></mat-icon>
34-
DOCUMENTATION
35-
</a>
36-
</span>
27+
<button mat-button (click)="openDocumentation()">
28+
<mat-icon inline class="mdi mdi-book-open-page-variant"></mat-icon>
29+
DOCUMENTATION
30+
</button>
3731
<span class="fill-space"></span>
38-
<span>
39-
<a
40-
mat-button
41-
href="https://github.com/t-ho/ngx-ui-loader"
42-
target="_blank"
43-
>
44-
<mat-icon
45-
fontIcon="mdi-github"
46-
fontSet="mdi"
47-
class="mdi-24px"
48-
></mat-icon
49-
>Github
50-
</a>
51-
</span>
32+
<button mat-button (click)="openGithub()">
33+
<mat-icon inline class="mdi mdi-github"></mat-icon>
34+
Github
35+
</button>
5236
</mat-toolbar>
5337

5438
<h2>NGX-UI-LOADER</h2>
55-
<div fxLayout="row wrap" fxLayoutAlign="center" fxLayoutGap="8px">
39+
<div class="layout-row-wrap fxLayoutAlign-center" style="gap: 8px;">
5640
<a href="https://www.npmjs.com/package/ngx-ui-loader" target="_blank">
5741
<img
5842
alt="NPM Version"

src/app/app.component.scss

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@ mat-slider {
2929
padding: 12px;
3030
}
3131

32-
.mat-icon.mdi-24px {
33-
line-height: 24px;
34-
margin-right: 4px;
35-
margin-bottom: 3px;
32+
mat-toolbar mat-icon.mdi {
33+
font-size: 18px;
3634
}
3735

3836
.config-info {

src/app/app.component.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,38 @@
11
import { Component, ViewContainerRef } from '@angular/core';
2+
import { NgxUiLoaderModule } from 'ngx-ui-loader';
3+
import { RouterOutlet } from '@angular/router';
4+
import { MatToolbarModule } from '@angular/material/toolbar';
5+
import { MatIconModule } from '@angular/material/icon';
6+
import { MatButtonModule } from '@angular/material/button';
27

38
import { DemoService } from './demo.service';
49

510
@Component({
611
selector: 'app-root',
712
templateUrl: './app.component.html',
813
styleUrls: ['./app.component.scss'],
14+
imports: [
15+
NgxUiLoaderModule,
16+
RouterOutlet,
17+
MatToolbarModule,
18+
MatIconModule,
19+
MatButtonModule,
20+
],
921
})
1022
export class AppComponent {
1123
/**
1224
* Constructor
1325
*/
1426
constructor(
1527
public demoService: DemoService,
16-
public vcRef: ViewContainerRef
28+
public vcRef: ViewContainerRef,
1729
) {}
30+
31+
openDocumentation() {
32+
window.open('https://tdev.app/ngx-ui-loader', '_blank');
33+
}
34+
35+
openGithub() {
36+
window.open('https://github.com/t-ho/ngx-ui-loader', '_blank');
37+
}
1838
}

src/app/app.module.ts

Lines changed: 0 additions & 118 deletions
This file was deleted.

src/app/app.routes.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { Routes } from '@angular/router';
2+
3+
export const routes: Routes = [
4+
{
5+
path: 'spinners',
6+
loadComponent: () =>
7+
import('./spinners/spinners.component').then((m) => m.SpinnersComponent),
8+
},
9+
{
10+
path: 'multiloaders',
11+
loadComponent: () =>
12+
import('./multiloaders/multiloaders.component').then(
13+
(m) => m.MultiloadersComponent,
14+
),
15+
},
16+
{
17+
path: 'custom-template',
18+
loadComponent: () =>
19+
import('./custom-template/custom-template.component').then(
20+
(m) => m.CustomTemplateComponent,
21+
),
22+
},
23+
{
24+
path: '',
25+
loadComponent: () =>
26+
import('./master-configuration/master-configuration.component').then(
27+
(m) => m.MasterConfigurationComponent,
28+
),
29+
},
30+
];

src/app/controller/controller.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<mat-list role="list" fxFlex="100" *ngIf="loader">
1+
<mat-list role="list" class="fxFlex-100" *ngIf="loader">
22
<h3>
33
<code>loaderId = "{{ loader.loaderId }}"</code>
44
{{ loader.isMaster ? "- (master loader)" : "" }}

0 commit comments

Comments
 (0)