So, I have a few questions:
1) What is the proper way to use a p-dropdown with a label that matches the same label position, size, and color used for text inputs?
2) In my form, I had hoped to allow p-dropdown fields to be "empty", but required, so that the normal angular2 "required" validation would work if the user does not select a value. Is that possible?
Screenshot:
Here is the code used for that screenshot:
Code: Select all
<div class="ui-g">
<div class="ui-g-12 ui-md-6">
<span class="md-inputfield">
<input formControlName="companyName" type="text" pInputText>
<label [attr.for]="companyName">Company Name:</label>
<div class="ui-message ui-messages-error ui-corner-all">
{{ formErrors['companyName'] }}
</div>
</span>
</div>
<div class="ui-g-12 ui-md-6">
<span class="md-inputfield">
<p-dropdown class="ui-state-filled ui-inputwrapper-focus" [options]="companyTypeOptions" formControlName="companyType" id="companyType"
[autoWidth]="false" required></p-dropdown>
<label [attr.for]="companyName">Company Type:</label>
<div class="ui-message ui-messages-error ui-corner-all">
{{ formErrors['companyName'] }}
</div>
</span>
</div>
</div>