Subject vs BehaviorSubject vs ReplaySubject in Angular

It really comes down to behavior and semantics. With a Subject – a subscriber will only get published values that were emitted after the subscription. Ask yourself, is that what you want? Does the subscriber need to know anything about previous values? If not, then you can use this, otherwise choose one of the others. … Read more

Angular 2: 404 error occur when I refresh through the browser [duplicate]

Update for Angular 2 final version In app.module.ts: Add imports: import { HashLocationStrategy, LocationStrategy } from ‘@angular/common’; And in NgModule provider, add: {provide: LocationStrategy, useClass: HashLocationStrategy} Example (app.module.ts): import { NgModule } from ‘@angular/core’; import { BrowserModule } from ‘@angular/platform-browser’; import { AppComponent } from ‘./app.component’; import { HashLocationStrategy, LocationStrategy } from ‘@angular/common’; @NgModule({ declarations: … Read more

How to display the app version in Angular?

If you want to use/show the version number in your angular app please do the following: Prerequisites: Angular file and folder structure created via Angular CLI Steps for Angular 6.1 (TS 2.9+) till Angular 11 In your /tsconfig.json (sometimes also necessary in /src/tsconfig.app.json) enable the following option (webpack dev server restart required afterwards): “compilerOptions”: { … Read more

Can’t bind to ‘ngForOf’ since it isn’t a known property of ‘tr’ (final release)

Add BrowserModule to imports: [] in @NgModule() if it’s the root module (AppModule), otherwise the CommonModule. // older Angular versions // import {BrowserModule, CommonModule} from ‘@angular/common’; import { BrowserModule } from ‘@angular/platform-browser’ .. .. @NgModule({ imports: [BrowserModule, /* or CommonModule */], .. })

Adding a HTTP header to the Angular HttpClient doesn’t send the header, why?

The instances of the new HttpHeader class are immutable objects. Invoking class methods will return a new instance as result. So basically, you need to do the following: let headers = new HttpHeaders(); headers = headers.set(‘Content-Type’, ‘application/json; charset=utf-8’); or const headers = new HttpHeaders({‘Content-Type’:’application/json; charset=utf-8′}); Update: adding multiple headers let headers = new HttpHeaders(); headers … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)