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

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.

How to set environment via `ng serve` in Angular 6

You need to use the new configuration option (this works for ng build and ng serve as well) ng serve –configuration=local or ng serve -c local If you look at your angular.json file, you’ll see that you have finer control over settings for each configuration (aot, optimizer, environment files,…) “configurations”: { “production”: { “optimization”: true, … Read more

Angular-cli from css to scss

For Angular 6 check the Official documentation Note: For @angular/cli versions older than 6.0.0-beta.6 use ng set in place of ng config. For existing projects In an existing angular-cli project that was set up with the default css styles you will need to do a few things: Change the default style extension to scss Manually … Read more