Angular 4 Form Validators – minLength & maxLength does not work on field type number

Used it like following and worked perfectly : phone: [”, [Validators.required, Validators.min(10000000000), Validators.max(999999999999)]], customValidationService : import { AbstractControl, ValidatorFn } from ‘@angular/forms’; export class customValidationService { static checkLimit(min: number, max: number): ValidatorFn { return (c: AbstractControl): { [key: string]: boolean } | null => { if (c.value && (isNaN(c.value) || c.value < min || c.value … Read more

Get Value From Select Option in Angular 4

As a general (see Stackblitz here: https://stackblitz.com/edit/angular-gh2rjx): HTML <select [(ngModel)]=”selectedOption”> <option *ngFor=”let o of options”> {{o.name}} </option> </select> <button (click)=”print()”>Click me</button> <p>Selected option: {{ selectedOption }}</p> <p>Button output: {{ printedOption }}</p> Typescript export class AppComponent { selectedOption: string; printedOption: string; options = [ { name: “option1”, value: 1 }, { name: “option2”, value: 2 } … Read more

Property ‘controls’ does not exist on type ‘AbstractControl’ Angular 4 [duplicate]

Based on @Günter Zöchbauer comments , first i changed myForm.controls[‘addresses’] to myForm.get(‘addresses’) in both html and typescript and then based on @yuruzi comment changed myForm.get(‘addresses’).controls to myForm.get(‘addresses’)[‘controls’] Its working fine now. Thanks @gunter & yuruzi

Angular4 – No value accessor for form control

You can use formControlName only on directives which implement ControlValueAccessor. Implement the interface So, in order to do what you want, you have to create a component which implements ControlValueAccessor, which means implementing the following three functions: writeValue (tells Angular how to write value from model into view) registerOnChange (registers a handler function that is … Read more

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