@@ -249,18 +249,21 @@ <h3 class="demo-content__headline">Text Field - FormControl</h3>
249249 < button mdc-button (click) ="demoformInput.useNativeValidation = !demoformInput.useNativeValidation "> Use native validation: {{demoformInput.useNativeValidation ? 'On' : 'Off'}}</ button >
250250 < button mdc-button (click) ="alternateColors(demoformInput) "> Alternate Colors</ button >
251251 </ div >
252- < form [formGroup] ="demoForm " id ="demoForm " (ngSubmit) ="submitForm() ">
253- < mdc-text-field #demoformInput formControlName ="userName " label ="Username " outlined [readonly] ="readonly " [helperText] ="demoformHelper " required minlength ="3 "> </ mdc-text-field >
254- < mdc-text-field-helper-text #demoformHelper ="mdcHelperText " validation >
255- < span *ngIf ="demoForm.controls['userName'].errors?.required "> Username is required</ span >
256- < span *ngIf ="demoForm.controls['userName'].errors?.minlength "> Username is not long enough</ span >
257- </ mdc-text-field-helper-text >
252+ < form [formGroup] ="demoForm " id ="demoForm ">
253+ < mdc-form-field >
254+ < mdc-text-field #demoformInput formControlName ="username " label ="Username " outlined [helperText] ="demoformHelper " required minlength ="3 "> </ mdc-text-field >
255+ < mdc-text-field-helper-text #demoformHelper ="mdcHelperText " validation >
256+ < span *ngIf ="demoForm.controls['username'].errors?.required "> Username is required</ span >
257+ < span *ngIf ="demoForm.controls['username'].errors?.minlength "> Username is not long enough</ span >
258+ </ mdc-text-field-helper-text >
259+ </ mdc-form-field >
258260 </ form >
259261 < div class ="demo-layout__row ">
260262 < button mdc-button type ="submit " [disabled] ="!demoForm.valid " form ="demoForm "> Submit</ button >
261263 < button mdc-button (click) ="demoForm.reset() "> Reset</ button >
262- < button mdc-button (click) ="demoForm.controls['userName '].setValue('test') "> Set Value</ button >
264+ < button mdc-button (click) ="demoForm.controls['username '].setValue('test') "> Set Value</ button >
263265 </ div >
266+ < p > Control Valid: {{demoForm.controls['username'].valid}}</ p >
264267 < p > Dirty: {{ demoForm.dirty }}</ p >
265268 < p > Valid: {{ demoForm.valid }}</ p >
266269 < p > Pristine: {{ demoForm.pristine }}</ p >
@@ -277,16 +280,18 @@ <h3 class="demo-content__headline">Text Field - Numeric with ngModel Form</h3>
277280 < button mdc-button (click) ="demoweight.required = !demoweight.required "> Required: {{demoweight.required ? 'On' : 'Off'}}</ button >
278281 < button mdc-button (click) ="alternateColors(demoweight) "> Alternate Colors</ button >
279282 </ div >
280- < form #demoWeightForm ="ngForm " id ="demoWeightForm " (ngSubmit) ="submitWeightForm(demoWeightForm) ">
281- < mdc-text-field #demoweight type ="number " name ="demoweight " label ="Weight " ngModel #demoWeightModel ="ngModel "
282- required [helperText] ="weightHelper "> </ mdc-text-field >
283- < mdc-text-field-helper-text #weightHelper ="mdcHelperText " validation >
284- < span *ngIf ="!demoweight?.value "> Weight is required</ span >
285- </ mdc-text-field-helper-text >
283+ < form #demoWeightForm ="ngForm " id ="demoWeightForm ">
284+ < mdc-form-field >
285+ < mdc-text-field #demoweight type ="number " name ="demoweight " label ="Weight " ngModel #demoWeightModel ="ngModel "
286+ required [helperText] ="weightHelper "> </ mdc-text-field >
287+ < mdc-text-field-helper-text #weightHelper ="mdcHelperText " validation >
288+ < span *ngIf ="!demoweight?.value "> Weight is required</ span >
289+ </ mdc-text-field-helper-text >
290+ </ mdc-form-field >
286291 </ form >
287292 < div class ="demo-layout__row ">
288- < button mdc-button type ="submit " form ="demoWeightForm "> Submit</ button >
289- < button mdc-button (click) ="resetWeightModel( demoWeightForm) "> Reset</ button >
293+ < button mdc-button type ="submit " [disabled] =" !demoWeightForm.valid " form ="demoWeightForm "> Submit</ button >
294+ < button mdc-button (click) ="demoWeightForm.reset( ) "> Reset</ button >
290295 </ div >
291296 < p > Dirty: {{ demoWeightModel.dirty }}</ p >
292297 < p > Valid: {{ demoWeightForm.valid }}</ p >
@@ -317,10 +322,12 @@ <h3 class="demo-content__headline">Leading and Trailing Icons</h3>
317322 < div class ="demo-layout__row ">
318323 < button mdc-button (click) ="bothIcons.outlined = !bothIcons.outlined "> Outlined: {{bothIcons.outlined ? 'On' : 'Off'}}</ button >
319324 </ div >
320- < mdc-text-field autocomplete ="tel " type ="tel " #bothIcons label ="Phone number ">
321- < mdc-icon mdcTextFieldIcon leading > phone</ mdc-icon >
322- < mdc-icon mdcTextFieldIcon trailing > event</ mdc-icon >
323- </ mdc-text-field >
325+ < mdc-form-field >
326+ < mdc-text-field autocomplete ="tel " type ="tel " #bothIcons label ="Phone number ">
327+ < mdc-icon mdcTextFieldIcon leading > phone</ mdc-icon >
328+ < mdc-icon mdcTextFieldIcon trailing > event</ mdc-icon >
329+ </ mdc-text-field >
330+ </ mdc-form-field >
324331 </ div >
325332
326333 < div class ="demo-content ">
@@ -356,9 +363,7 @@ <h3 class="demo-content__headline">Examples</h3>
356363 < div class ="demo-content ">
357364 < h3 class ="demo-content__headline "> Numeric with ngModel</ h3 >
358365 < mdc-text-field type ="number " label ="Distance " [(ngModel)] ="waypoint.dt "> </ mdc-text-field >
359- < div class ="demo-layout__row ">
360- < button mdc-button (click) ="submitNumeric() "> Submit</ button >
361- </ div >
366+ < p > Model: {{waypoint | json}}</ p >
362367 </ div >
363368
364369 < div class ="demo-content ">
@@ -370,10 +375,18 @@ <h3 class="demo-content__headline">Prefilled via ngModel</h3>
370375 < div class ="demo-content ">
371376 < h3 class ="demo-content__headline "> Date / Time / Color / Password</ h3 >
372377 < div class ="demo-layout__row ">
373- < mdc-text-field type ="date " label ="Birthday " outlined > </ mdc-text-field >
374- < mdc-text-field type ="time " label ="Time " outlined > </ mdc-text-field >
375- < mdc-text-field type ="password " label ="Password " required outlined > </ mdc-text-field >
376- < mdc-text-field type ="color " label ="Color " style ="width: 6rem " outlined > </ mdc-text-field >
378+ < mdc-form-field >
379+ < mdc-text-field type ="date " label ="Birthday " outlined > </ mdc-text-field >
380+ </ mdc-form-field >
381+ < mdc-form-field >
382+ < mdc-text-field type ="time " label ="Time " outlined > </ mdc-text-field >
383+ </ mdc-form-field >
384+ < mdc-form-field >
385+ < mdc-text-field type ="password " label ="Password " required outlined > </ mdc-text-field >
386+ </ mdc-form-field >
387+ < mdc-form-field >
388+ < mdc-text-field type ="color " label ="Color " style ="width: 6rem " outlined > </ mdc-text-field >
389+ </ mdc-form-field >
377390 </ div >
378391 </ div >
379392
0 commit comments