Checking version of angular-cli that’s installed?
angular cli can report its version when you run it with the version flag ng –version
angular cli can report its version when you run it with the version flag ng –version
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
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
name: [{value: ”, disabled: true}, Validators.required], name: [{value: ”, disabled: this.isDisabled}, Validators.required], or this.form.controls[‘name’].disable();
I discovered that Jasmine allows you to prefix describe and it methods with an f (for focus): fdescribe and fit. If you use either of these, Karma will only run the relevant tests. To focus the current file, you can just take the top level describe and change it to fdescribe. If you use Jasmine … Read more
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
I hope you’ve installed – npm install –save-dev @types/jasmine Then put following import at the top of the hero.spec.ts file – import ‘jasmine’; It should solve the problem.
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 */], .. })
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