npm WARN … requires a peer of … but none is installed. You must install peer dependencies yourself

“A requires a peer of B but none was installed”. Consider it as “A requires one of B’s peers but that peer was not installed and we’re not telling you which of B’s peers you need.” The automatic installation of peer dependencies was explicitly removed with npm 3. NPM Blog Release notes of v3 So … Read more

How to bundle an Angular app for production

2 to 14 (TypeScript) with Angular CLI OneTime Setup npm install -g @angular/cli ng new projectFolder creates a new application Bundling Step ng build (run in command line when directory is projectFolder). flag prod bundle for production is now the default (see the Angular documentation to customize it if needed). Compress using Brotli compression the … Read more

Can’t bind to ‘ngIf’ since it isn’t a known property of ‘div’ [duplicate]

If you are using RC5 then import this: import { CommonModule } from ‘@angular/common’; import { BrowserModule } from ‘@angular/platform-browser’; and be sure to import CommonModule from the module that is providing your component. @NgModule({ imports: [CommonModule], declarations: [MyComponent] … }) class MyComponentModule {}

Angular 2 change event on every keypress

I just used the event input and it worked fine as follows: in .html file : <input type=”text” class=”form-control” (input)=”onSearchChange($event.target.value)”> in .ts file : onSearchChange(searchValue: string): void { console.log(searchValue); }

Angular error: “Can’t bind to ‘ngModel’ since it isn’t a known property of ‘input'”

In order to use two-way data binding for form inputs you need to import the FormsModule package in your Angular module. import { FormsModule } from ‘@angular/forms’; @NgModule({ imports: [ FormsModule ] EDIT Since there are lot of duplicate questions with the same problem, I am enhancing this answer. There are two possible reasons Missing … Read more

How to use jQuery with Angular?

Using jQuery from Angular2 is a breeze compared to ng1. If you are using TypeScript you could first reference jQuery typescript definition. tsd install jquery –save or typings install dt~jquery –global –save TypescriptDefinitions are not required since you could just use any as the type for $ or jQuery In your angular component you should … Read more

What is the difference between Subject and BehaviorSubject?

A BehaviorSubject holds one value. When it is subscribed it emits the value immediately. A Subject doesn’t hold a value. Subject example (with RxJS 5 API): const subject = new Rx.Subject(); subject.next(1); subject.subscribe(x => console.log(x)); Console output will be empty BehaviorSubject example: const subject = new Rx.BehaviorSubject(0); subject.next(1); subject.subscribe(x => console.log(x)); Console output: 1 In … Read more

Expression ___ has changed after it was checked

As stated by drewmoore, the proper solution in this case is to manually trigger change detection for the current component. This is done using the detectChanges() method of the ChangeDetectorRef object (imported from angular2/core), or its markForCheck() method, which also makes any parent components update. Relevant example: import { Component, ChangeDetectorRef, AfterViewInit } from ‘angular2/core’ … Read more

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