<section class="login-block">
<div class="container">
<div class="row">
<div class="col-md-4 login-sec">
<h2 class="text-center">Inquiry</h2>
<form class="login-form" [formGroup]="inquiryForm" (ngSubmit)="onSubmit()">
<div class="form-group">
<label class="text-uppercase">Full Name *</label>
<input type="text" class="form-control" formControlName="full_name">
</div>
<div class="form-group">
<label class="text-uppercase">Email *</label>
<input type="text" class="form-control" formControlName="email">
</div>
<div class="form-group">
<label class="text-uppercase">Phone Number *</label>
<input type="number" class="form-control" formControlName="phone_number">
</div>
<div class="form-group">
<label class="text-uppercase">What do you need?</label>
<select class="form-control" formControlName="purpose">
<option>Share Market</option>
<option>Mutual Funds</option>
<option>Insurance</option>
</select>
</div>
<div class="form-group">
<label class="text-uppercase">Message</label>
<textarea class="form-control" formControlName="message" rows="3"></textarea>
</div>
<button [disabled]="!inquiryForm.valid" type="submit" class="btn btn-login float-right">Submit</button>
</form>
</div>
<div class="col-md-8 banner-sec">
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<div class="carousel-inner" role="listbox">
<div class="carousel-item active">
<div class="carousel-caption d-none d-md-block">
<div class="banner-text">
<h2>This is Heaven</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
inquiryForm = this.formBuilder.group({
full_name: new FormControl('', [Validators.required]),
email: new FormControl('', [Validators.required, Validators.email]),
phone_number: new FormControl('', [Validators.required]),
purpose: new FormControl('', []),
message: new FormControl('', [])
});
constructor(private formBuilder: FormBuilder) { }
ngOnInit() {
}
onSubmit() {
if (this.inquiryForm.valid) {
const _v = this.inquiryForm.value;
const form = new FormData();
form.append('full_name', _v.full_name);
form.append('email', _v.email);
form.append('phone_number', _v.phone_number);
form.append('purpose', _v.purpose);
form.append('message', _v.message);
// Submit your form to app call
}
}
}