@igniteui/angular-templates 18.0.1330-beta.2 → 18.0.1330-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,7 +19,7 @@
19
19
  "@angular/platform-browser-dynamic": "~18.0.0",
20
20
  "@angular/router": "~18.0.0",
21
21
  "hammerjs": "~2.0.8",
22
- "igniteui-angular": "~18.0.0-alpha.3",
22
+ "igniteui-angular": "~18.0.0-rc.0",
23
23
  "minireset.css": "~0.0.7",
24
24
  "rxjs": "~7.8.0",
25
25
  "tslib": "~2.3.0",
@@ -1,19 +1,34 @@
1
- import { ApplicationConfig, importProvidersFrom } from '@angular/core';
1
+ import { ApplicationConfig, ErrorHandler, Provider, importProvidersFrom } from '@angular/core';
2
2
  import { provideRouter, withComponentInputBinding } from '@angular/router';
3
- import { HammerModule } from '@angular/platform-browser';
3
+ import { BrowserModule, HammerModule } from '@angular/platform-browser';
4
4
  import { provideAnimations } from '@angular/platform-browser/animations';
5
- import { provideHttpClient } from '@angular/common/http';
5
+ import {
6
+ IgxNavigationDrawerModule,
7
+ IgxNavbarModule,
8
+ IgxLayoutModule,
9
+ IgxRippleModule,
10
+ } from 'igniteui-angular';
6
11
 
7
12
  import { routes } from './app.routes';
13
+ import { GlobalErrorHandlerService } from './error-routing/error/global-error-handler.service';
14
+ import { environment } from '../environments/environment';
8
15
 
9
- export const appConfig: ApplicationConfig = {
10
- providers: [
16
+ const providers: Provider[] = [
17
+ [
11
18
  provideRouter(routes, withComponentInputBinding()),
12
- importProvidersFrom(HammerModule),
13
- provideAnimations(),
14
- provideHttpClient()
19
+ importProvidersFrom(BrowserModule),
20
+ provideAnimations()
15
21
  // provide the HAMMER_GESTURE_CONFIG token
16
22
  // to override the default settings of the HammerModule
17
23
  // { provide: HAMMER_GESTURE_CONFIG, useClass: MyHammerConfig }
18
24
  ]
19
- };
25
+ ];
26
+
27
+ if (environment.production) {
28
+ providers.push({
29
+ provide: ErrorHandler,
30
+ useClass: GlobalErrorHandlerService
31
+ });
32
+ }
33
+
34
+ export const appConfig: ApplicationConfig = { providers };
@@ -0,0 +1,23 @@
1
+ import { ErrorHandler, Injectable, Injector, NgZone } from '@angular/core';
2
+ import { Router } from '@angular/router';
3
+
4
+ @Injectable()
5
+ export class GlobalErrorHandlerService implements ErrorHandler {
6
+
7
+ constructor(private injector: Injector, private zone: NgZone) { }
8
+
9
+ handleError(error: any) {
10
+ // handle and/or log error, for example:
11
+ console.error(error);
12
+
13
+ // show error page
14
+ const router = this.injector.get(Router);
15
+ if (router) {
16
+ this.zone.run(() => {
17
+ router
18
+ .navigate(['error'])
19
+ .catch((err: any) => console.error(err));
20
+ });
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,3 @@
1
+ export const environment = {
2
+ production: true
3
+ };
@@ -0,0 +1,3 @@
1
+ export const environment = {
2
+ production: false
3
+ };
@@ -1,7 +1,13 @@
1
+ import { enableProdMode } from '@angular/core';
1
2
  import { bootstrapApplication } from '@angular/platform-browser';
2
3
 
3
4
  import { appConfig } from './app/app.config';
4
5
  import { AppComponent } from './app/app.component';
6
+ import { environment } from './environments/environment';
7
+
8
+ if (environment.production) {
9
+ enableProdMode();
10
+ }
5
11
 
6
12
  bootstrapApplication(AppComponent, appConfig)
7
13
  .catch((err) => console.error(err));
@@ -20,7 +20,7 @@
20
20
  "@angular/platform-browser-dynamic": "~18.0.0",
21
21
  "@angular/router": "~18.0.0",
22
22
  "hammerjs": "^2.0.8",
23
- "igniteui-angular": "~18.0.0-alpha.3",
23
+ "igniteui-angular": "~18.0.0-rc.0",
24
24
  "minireset.css": "~0.0.7",
25
25
  "rxjs": "~7.8.0",
26
26
  "tslib": "~2.3.0",
@@ -3,6 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
3
3
 
4
4
  import { PageNotFoundComponent } from './error-routing/not-found/not-found.component';
5
5
  import { UncaughtErrorComponent } from './error-routing/error/uncaught-error.component';
6
+ import { ErrorRoutingModule } from './error-routing/error-routing.module';
6
7
 
7
8
  export const routes: Routes = [
8
9
  { path: 'error', component: UncaughtErrorComponent },
@@ -10,7 +11,7 @@ export const routes: Routes = [
10
11
  ];
11
12
 
12
13
  @NgModule({
13
- imports: [RouterModule.forRoot(routes, { bindToComponentInputs: true })],
14
- exports: [RouterModule]
14
+ imports: [RouterModule.forRoot(routes, { bindToComponentInputs: true }), ErrorRoutingModule],
15
+ exports: [RouterModule, ErrorRoutingModule]
15
16
  })
16
17
  export class AppRoutingModule { }
@@ -0,0 +1,23 @@
1
+ import { ErrorHandler, Injectable, Injector, NgZone } from '@angular/core';
2
+ import { Router } from '@angular/router';
3
+
4
+ @Injectable()
5
+ export class GlobalErrorHandlerService implements ErrorHandler {
6
+
7
+ constructor(private injector: Injector, private zone: NgZone) { }
8
+
9
+ handleError(error: any) {
10
+ // handle and/or log error, for example:
11
+ console.error(error);
12
+
13
+ // show error page
14
+ const router = this.injector.get(Router);
15
+ if (router) {
16
+ this.zone.run(() => {
17
+ router
18
+ .navigate(['error'])
19
+ .catch((err: any) => console.error(err));
20
+ });
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,21 @@
1
+ import { ErrorHandler, NgModule, Provider } from '@angular/core';
2
+ import { environment } from '../../environments/environment';
3
+ import { GlobalErrorHandlerService } from './error/global-error-handler.service';
4
+ import { UncaughtErrorComponent } from './error/uncaught-error.component';
5
+ import { PageNotFoundComponent } from './not-found/not-found.component';
6
+
7
+ const providers: Provider[] = [];
8
+
9
+ if (environment.production) {
10
+ // register prod error handler
11
+ providers.push({ provide: ErrorHandler, useClass: GlobalErrorHandlerService });
12
+ }
13
+
14
+ @NgModule({
15
+ declarations: [
16
+ PageNotFoundComponent,
17
+ UncaughtErrorComponent
18
+ ],
19
+ providers
20
+ })
21
+ export class ErrorRoutingModule { }
@@ -0,0 +1,3 @@
1
+ export const environment = {
2
+ production: true
3
+ };
@@ -0,0 +1,3 @@
1
+ export const environment = {
2
+ production: false
3
+ };
@@ -1,6 +1,12 @@
1
+ import { enableProdMode } from '@angular/core';
1
2
  import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
2
3
 
3
4
  import { AppModule } from './app/app.module';
5
+ import { environment } from './environments/environment';
6
+
7
+ if (environment.production) {
8
+ enableProdMode();
9
+ }
4
10
 
5
11
  platformBrowserDynamic().bootstrapModule(AppModule)
6
12
  .catch(err => console.error(err));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@igniteui/angular-templates",
3
- "version": "18.0.1330-beta.2",
3
+ "version": "18.0.1330-rc.0",
4
4
  "description": "Templates for Ignite UI for Angular projects and components",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,7 +12,7 @@
12
12
  "author": "Infragistics",
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
- "@igniteui/cli-core": "~13.3.0-beta.2",
15
+ "@igniteui/cli-core": "~13.3.0-rc.0",
16
16
  "typescript": "~5.4.3"
17
17
  }
18
18
  }