-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add validate for angular material UI
- Loading branch information
Hung Pham
committed
May 18, 2023
1 parent
02610e7
commit b5347ee
Showing
19 changed files
with
1,081 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
projects/ngx-validator-demo/src/app/angular-material/angular-material.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-sm-12 col-md-10 col-lg-8 col-xl-6"> | ||
<section class="mt-5"> | ||
<h3> | ||
<small class="text-body-secondary">Simple form: </small> | ||
Add education | ||
</h3> | ||
|
||
<form (ngSubmit)="onSubmit()" [formGroup]="simpleForm"> | ||
<mat-card> | ||
<mat-card-content> | ||
<mat-form-field appearance="outline" class="mb-3"> | ||
<mat-label>School</mat-label> | ||
<input matInput placeholder="Ex: Northwestern University" formControlName="school"> | ||
</mat-form-field> | ||
|
||
<mat-form-field appearance="outline" class="mb-3"> | ||
<mat-label>Area of Study</mat-label> | ||
<input matInput placeholder="Ex: Northwestern University" formControlName="school"> | ||
</mat-form-field> | ||
|
||
<mat-form-field appearance="outline" class="mb-3"> | ||
<mat-label>Description</mat-label> | ||
<input matInput placeholder="Ex: Northwestern University" formControlName="school"> | ||
</mat-form-field> | ||
</mat-card-content> | ||
|
||
<mat-card-actions> | ||
<button mat-raised-button color="primary">LIKE</button> | ||
</mat-card-actions> | ||
|
||
</mat-card> | ||
</form> | ||
</section> | ||
</div> | ||
</div> | ||
</div> |
13 changes: 13 additions & 0 deletions
13
projects/ngx-validator-demo/src/app/angular-material/angular-material.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.mat-mdc-form-field { | ||
width: 100%; | ||
} | ||
|
||
.mat-mdc-card-content { | ||
padding-left: 24px; | ||
padding-right: 24px; | ||
} | ||
|
||
.mat-mdc-card-actions { | ||
padding-left: 24px; | ||
padding-right: 24px; | ||
} |
21 changes: 21 additions & 0 deletions
21
projects/ngx-validator-demo/src/app/angular-material/angular-material.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Component } from '@angular/core'; | ||
import { FormBuilder, Validators } from '@angular/forms'; | ||
|
||
@Component({ | ||
selector: 'app-angular-material', | ||
templateUrl: './angular-material.component.html', | ||
styleUrls: ['./angular-material.component.scss'] | ||
}) | ||
export class AngularMaterialComponent { | ||
simpleForm = this.formBuilder.group({ | ||
school: ['', [Validators.required]], | ||
degree: ['', [Validators.required]], | ||
areaOfStudy: ['', [Validators.required]], | ||
description: ['', [Validators.required]], | ||
}); | ||
|
||
constructor(private formBuilder: FormBuilder) { } | ||
|
||
onSubmit(): void { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.