Skip to main content

Posts

Showing posts with the label Angular 6 Custom ErrorHandler

Angular 6 CRUD Operations Application and Example

The following frameworks, and modules are required for CREATE Angular 6 CRUD Applications : 1.       Node.js (recommended version) 2.       Angular CLI 3.       Angular 6 4.       Visual Studio code 5.       Node Command Line (Windows) or Integrated terminal Suppose that you have installed Node.js . Now, you need to check the versions of both Node.js and NPM.   Open the Integrated terminal or Node command line then type the below commands. node - v v8 . 11.1 And npm - v 6.0 . 0 Install Angular CLI and Create Angular 6 Web Application - To install or upgrade the latest Angular 6 CLI, type this command in the integrated terminal or Node command line. npm install - g @ angular / cli Now, you can create a new Angular 6 Web Application using this Angular CLI command. ng new Angular6App Next, go to the newly c...

How to Create a Custom ErrorHandler?

How to create a custom ErrorHandler? The best way to log exceptions is to provide a specific log message for each possible exception. Always ensure that sufficient information is being logged and that nothing important is being excluded. The multiple steps involved in creating custom error logging in Angular - 1.            Create a constant class for global error messages. 2.            Create an error log service – ErrorLoggService . 3.            Create a global error handler for using the error log service for logging errors. Steps 1 – In the first step, we will create a constant class for logging global error messages and its look like this. export class AppConstants {   public static get baseURL (): string { return 'http://localhost:4200/api' ; }   public static get httpError (): string { ...