Thursday, July 13, 2017

It may at times be wise to cast a FormGroup to an any in TypeScript and Angular 2 before doing a dot dot dot out past the controls on it.

Typing out something hanging off .controls will work when you just run the app standalone most likely, but if something actually does sanity checking with the compiler such as a Webpack CI process you are in trouble.

let altF: any = <any>this.f;
let whatever: string = altF.controls.Person.controls.LastName.value;

No comments:

Post a Comment