how to pass data from angular material dialog to parent component?

Check full Tutorial Link Just pass data back from Dialog component to parent in close() method //dialog-box.component.ts import { Component, Inject, Optional } from ‘@angular/core’; import { MatDialogRef, MAT_DIALOG_DATA } from ‘@angular/material’; export interface UsersData { name: string; id: number; } @Component({ selector: ‘app-dialog-box’, templateUrl: ‘./dialog-box.component.html’, styleUrls: [‘./dialog-box.component.css’] }) export class DialogBoxComponent { action:string; local_data:any; … Read more

Difference between ng add vs npm install in angular 6

ng add ng add <package> uses your package manager and installs the dependency. That dependency can have an installation script which can be used to do more job except the dependency installation. It can update your configurations, download another dependencies based on that one or create scaffold templates (with initial markup and logic). To use … Read more

Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

I got this error and found this: https://fluin.io/blog/critical-dependency-cannot-be-statically-extracted, where the author shows he was getting the same warning. However, I wasn’t using Angular Elements, but I got the idea it might be related to the same problem, so I went ahead and checked whether I was using @angular/compiler/src/core in any of my imports. And I … Read more

Angular 6 Downloading file from rest api

I resolved it as follows: // header.component.ts this.downloadService.getPdf().subscribe((data) => { this.blob = new Blob([data], {type: ‘application/pdf’}); var downloadURL = window.URL.createObjectURL(data); var link = document.createElement(‘a’); link.href = downloadURL; link.download = “help.pdf”; link.click(); }); //download.service.ts getPdf() { const httpOptions = { responseType: ‘blob’ as ‘json’) }; return this.http.get(`${this.BASE_URL}/help/pdf`, httpOptions); }

How to run the Dist Folder on Local Machine in Angular 6+?

You can do that using http-server package. First install the package globally npm install http-server -g Then inside your project directory(in the terminal) just run http-server dist/ And if you are using Angular 6+ or above (Working with Angular 10), You have to run http-server dist/your-project-name Now you can visit http://localhost:8080 to view your application

Error: Schema validation failed with the following errors: Data path “” should NOT have additional properties(project)

The issue is generally because of a version mismatch in your package.json file. In my Angular 7 app, I have changed “@angular-devkit/build-angular”: “^0.800.2” to “@angular-devkit/build-angular”: “~0.7.0”. Then I ran the command npm install after deleting node_modules. Aside: Use ^ carefully. Your working code may not work in the future if there is a major change … Read more

File not found.