want to show more data in another component when view in detail button is clicked (angular 6)

Create a data sharing service first, here’s sample code, you should modify according to your need Data sharing service import { Injectable } from ‘@angular/core’; import { BehaviorSubject } from ‘rxjs/BehaviorSubject’; @Injectable() export class DataSharingService { private title = new BehaviorSubject<string>(“”); currentTitle = this.title.asObservable(); setTitle(txt: string){ this.title.next(txt); } } inject this service into your incident … Read more

Update to Angular v6 – Module not found: Error: Can’t resolve ‘fs’

Since previous answers are quite old, it might help to highlight here that a workaround for Angular9 is just to add the following in your package.json: “browser”: { “fs”: false, “os”: false, “path”: false } This works very well for me. For reference, I found this solution on the official tensorflow/tfjs Github page here.

Select All mat option and deselect All

Use code as below create function on click each mat-option and select()/deselect() all option: See stackblitz:https://stackblitz.com/edit/angular-material-with-angular-v5-jsgvx6?file=app/app.component.html TS: togglePerOne(all){ if (this.allSelected.selected) { this.allSelected.deselect(); return false; } if(this.searchUserForm.controls.userType.value.length==this.userTypeFilters.length) this.allSelected.select(); } toggleAllSelection() { if (this.allSelected.selected) { this.searchUserForm.controls.userType .patchValue([…this.userTypeFilters.map(item => item.key), 0]); } else { this.searchUserForm.controls.userType.patchValue([]); } } HTML: <form [formGroup]=”searchUserForm” fxFlex fxLayout=”column” autocomplete=”off” style=”margin: 30px”> <mat-select placeholder=”User Type” … Read more

How to pass multiple parameter to @Directives (@Components) in Angular with TypeScript?

From the Documentation As with components, you can add as many directive property bindings as you need by stringing them along in the template. Add an input property to HighlightDirective called defaultColor: @Input() defaultColor: string; Markup <p [myHighlight]=”color” defaultColor=”violet”> Highlight me too! </p> Angular knows that the defaultColor binding belongs to the HighlightDirective because you … Read more

Angular 6 does not add X-XSRF-TOKEN header to http request

The problem once again is Angular’s poor documentation. The fact is, Angular will add the X-XSRF-TOKEN header only if the XSRF-TOKEN cookie was generated server-side with the following options: Path = / httpOnly = false (this is very important, and fully undocumented) Besides, the Angular app and the URL being called must reside on the … Read more