angular-docs-cn/packages/forms/src
cexbrayat 628b0c1154 feat(forms): formControlName also accepts a number (#30606)
This commit relaxes the type of the `formControlName` input to accept both a `string` and a `number`.

Currently, when using a `FormArray`, most templates look like:

```
<div formArrayName="tags">
  <div *ngFor="let tag of tagsArray.controls; index as i">
    <input [formControlName]="i">
  </div>
</div>
```

Here `formControlName` receives a number whereas its input type is a string.

This is fine for VE and `fullTemplateTypeCheck`, but not for Ivy which does a more thorough type checking on inputs with `fullTemplateTypeCheck` enabled and throws `Type 'number' is not assignable to type 'string'`. It is fixable by using `formControlName="{{i}}"` but you have to know the difference between `a="{{b}}"` and `[a]="b"` and change it all over the application codebase. This commit allows the existing code to still type-check.

PR Close #30606
2019-08-13 14:21:25 -07:00
..
directives feat(forms): formControlName also accepts a number (#30606) 2019-08-13 14:21:25 -07:00
directives.ts build: enable bundle_dts for forms package (#28854) 2019-03-05 11:39:16 -08:00
form_builder.ts refactor(docs-infra): remove `linenums=false` since it is now the default (#31674) 2019-07-24 14:38:54 -07:00
form_providers.ts docs(forms): remove duplicated link (#27884) 2019-01-09 12:43:29 -08:00
forms.ts build: enable bundle_dts for forms package (#28854) 2019-03-05 11:39:16 -08:00
model.ts refactor(forms): ensure compatibility with typescript strict flag (#30993) 2019-07-18 14:21:26 -07:00
validators.ts docs: clarify docs for runtime validation change (#31596) 2019-07-16 23:58:11 -04:00
version.ts docs: update forms with `@publicApi` tags (#26595) 2018-10-19 14:35:53 -07:00