I have 2 textboxes AuthorizeRep1Fname and AuthorizeRep1Lname. I'm combining it together on typescript before I put it on 1 column in database which is AuthorizeRep1Name. Look at the photo below that's the result.
I'm using this to register and combine first name and last name.
this.Profile.AuthorizedRep1Name = (this.Profile.AuthorizedRep1FName + ' ' +
this.Profile.AuthorizedRep1LName);
this.ProfileService.UpdateProfile(this.Profile).then(
(response) => {
console.log(this.Profile)
}
Here's my html.
<div class="row mx-auto">
<div class="col-sm-12 col-md-6 col-lg-6">
<div class="input-container">
<label for="Representative1">* First Name </label>
<input name="r1fname" #r1fname="ngModel" id="Representative1Fname" type="text" [(ngModel)]="Profile.AuthorizedRep1FName" pInputText required/>
<div class="errortxt" [hidden]="r1fname.valid || r1fname.pristine" class="alert alert-danger">
<div class="errortxt" [hidden]="!r1fname.hasError('required')">First Name is Required!</div>
</div>
</div>
</div>
<div class="col-sm-12 col-md-6 col-lg-6">
<div class="input-container">
<label for="Representative1">* Last Name </label>
<input name="r1lname" #r1lname="ngModel" id="Representative1Lname" type="text" [(ngModel)]="Profile.AuthorizedRep1LName" pInputText required/>
<div class="errortxt" [hidden]="r1lname.valid || r1lname.pristine" class="alert alert-danger">
<div class="errortxt" [hidden]="!r1lname.hasError('required')">Last Name is Required!</div>
</div>
</div>
</div>
My problem is I can't separate and display the data from database to my two textboxes I can only display when I use ngModel AuthorizeRep1Name instead of AuthorizeRep1Fname and AuthorizeRep1Lname. Here's my get function.
GetProfileByID(UserID: any) {
this.ProfileService.GetProfileByID(UserID).then(
(response) => {
this.Profile = response.Body;
}
)
}