Created
October 25, 2023 18:48
-
-
Save teomanofficial/9ddb1f136e521bf74fd7d3775c541ba2 to your computer and use it in GitHub Desktop.
Angular Forms & Two Way Data Binding
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
@Component({ | |
// selector: 'app-root', | |
// templateUrl: './app.component.html', | |
// styleUrls: ['./app.component.css'] | |
// }) | |
// export class AppComponent { | |
// user = { name: '', surname: '' } | |
// } | |
<div class="container mt-5"> | |
<form #userForm="ngForm" (ngSubmit)="onFormSubmit(userForm)"> | |
<div class="card mb-3 bg-secondary text-white"> | |
<div class="card-body"> | |
Full Name: {{ user.name }} {{ user.surname }} | |
</div> | |
</div> | |
<div class="form-group"> | |
<label for="name">İsim</label> | |
<input type="text" [(ngModel)]="user.name" name="name" id="name" class="form-control" placeholder="İsim girinix" required maxlength="50" minlength="2"> | |
</div> | |
<div class="form-group"> | |
<label for="surname">Soyisim</label> | |
<input type="text" [(ngModel)]="user.surname" name="surname" id="surname" class="form-control" placeholder="Soyisim giriniz" required maxlength="50" minlength="2"> | |
</div> | |
</form> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment