I have a form and am trying to figure out why as soon as I add the attribute "formControlName" value stops rendering. I ended up boiling things down to a very simple example:
This:
<mat-form-field [style.width.px]=400>
<mat-label>Port Redirects</mat-label>
<input matInput placeholder="Ex. Pizza" value="Sushi">
</mat-form-field>
will render Sushi as expected:
However as soon as you add formControlName like this:
<mat-form-field [style.width.px]=400>
<mat-label>Port Redirects</mat-label>
<input matInput formControlName="port_list" placeholder="Ex. Pizza" value="Sushi">
</mat-form-field>
the value just up and disappears:
The official documentation says this is the way to do it so I'm at a loss as to why adding formControlName breaks things. Aside from the value field not working correctly, the form is otherwise just fine. Does everything I would expect it to. Is there a trick I'm missing?


formControlName must be used with a parent formGroup directive.. Take a look at the stackblitz here: stackblitz.com/edit/angular-mat-form-field-p6usms .. Here the value can be set also you can change but it won't store into the control for which you need to make a formGroup and set the formcontrol intsfile.. But as you are familiar I hope you know that steps..