Currently I'm working on a project using Angular 5 with primeng. I'm trying to append the country which coming from a dropdown to the phone number in a reactive form. I'm having a problem when I select a country code from a dropdown It doesn't append to the telephone number which I do have to pass the value.
import { Component } from '@angular/core';
import { FormGroup, FormControl } from '@angular/forms';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
profileForm = new FormGroup({
phoneNumber: new FormControl('')
})
onSubmit(phoneValue){
console.log(phoneValue)
}
onCountryChange(event){
console.log(event);
}
}
<form [formGroup]="profileForm" (ngSubmit)="onSubmit(profileForm.value)">
<div class="ui-g-12 ui-xs-12 ui-sm-12 ui-md-12 ui-lg-4 responsiveForIpad">
<div class="ui-g passengerMainDetails">
<div class="ui-g-12 ui-xs-12 ui-sm-12 ui-md-12 ui-lg-12">
<label> Contact Number *</label>
</div>
<div class="ui-g-12 ui-xs-12 ui-sm-12 ui-md-12 ui-lg-12">
<input type="text" formControlName="phoneNumber" ng2TelInput (countryChange)="onCountryChange($event)" placeholder="Please Enter the Phone number here"/>
</div>
</div>
</div>
</form>
