Title: new angular development features and improvements with error handling webinar by google employees
About Angular: Angular is a Typescript-based open-source front-end web application platform led by the Angular Team at Google and by a community of individuals and corporations. What we’ll cover in this webinar... Any error you can fix after this webinar 1. Angular error handling with latest strategies 2. New tips to write clean and per-formant angular application 3. Improving the testability of the angular app 4. Add caching to APIs and Migrating to PWA 5. State Management in Angular 6. User Activity logging with Azure Application Insights 7. Integrate with any technology Speaker: Ryan Russul who is a speaker and having 8 years of experience in UI development and worked as senior solution architect, practising code re-usability and enterprise practices in angular development among all teams who were responsible for angular development. Join in webinar: http://ovpurl.com/c2V5oNgM [image: angular-webinar-31st.jpg] On Thursday, October 11, 2018 at 9:59:31 AM UTC+5:30, Partha Majumdar wrote: > > > Dear Sir/Madam, > > > I have put an additional field in the data containing the details. When > the dialog display, the details are not shown. When I check the variable > containing details, it has values in it. > > > Please suggest what could be wrong. > > > Regards, > > Partha > > > *error.component.ts* > > import { Component, Inject } from '@angular/core'; > import { MAT_DIALOG_DATA } from '@angular/material'; > > @Component({ > // selector: 'app-footer', > templateUrl: './error.component.html', > styleUrls: ['./error.component.css'] > }) > export class ErrorComponent { > constructor(@Inject(MAT_DIALOG_DATA) public data: {message: string, > details: string}) {} > } > > > *error.component.html* > > <table border=0> > <tr> > <td align="center"> > <h1 mat-dialog-title>Error</h1> > </td> > </tr> > <tr> > <td align="center"> > <div mat-dialog-content> > <textarea matInput rows=1 cols=80 readonly>{{ data.message > }}</textarea> > </div> > </td> > <td align="left"> > <div mat-dialog-content> > <textarea matInput rows=5 cols=80 readonly>{{ data.details > }}</textarea> > </div> > </td> > </tr> > <tr align="center"> > <td align="center" width="100%"> > <div mat-dialog-actions> > <button mat-stroked-button mat-dialog-close color="warn">Ok!</button> > </div> > </td> > </tr> > </table> > > > > *error-interceptor.ts* > > import { HttpInterceptor, HttpRequest, HttpHandler, HttpErrorResponse } from > '@angular/common/http'; > import { catchError } from 'rxjs/operators'; > import { throwError } from 'rxjs'; > import { Injectable } from '@angular/core'; > import { MatDialog } from '@angular/material'; > > import { ErrorComponent } from './error/error.component'; > > @Injectable() > export class ErrorInterceptor implements HttpInterceptor { > constructor(private dialog: MatDialog) {} > > intercept(req: HttpRequest<any>, next: HttpHandler) { > return next.handle(req).pipe( > catchError( (error: HttpErrorResponse) => { > if (!req.url.endsWith('?upload=1')) { > let errorMessage = 'An unknown Error Occurred!!!'; > let errorDetails = ''; > if (error.error.message) { > errorMessage = error.error.message; > errorDetails = error.error.details; > } > this.dialog.open(ErrorComponent, {data: {message: errorMessage, > details: errorDetails}}); > } > return throwError(error); > } > ) > ); > } > } > > -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
