DEV Community

Gcobani Mkontwana
Gcobani Mkontwana

Posted on

Creating a phone book in Angular js when submit button is clicked previous data must displayed on the form table

Hi Team

How can write a form table when the instructions are as follows;

"Once the submit button is pressed, the information should be displayed in a list below (automatically sorted by last name) along with all the previous information that was entered. This way the application can function as a simple phone book. When your application loads, the input fields (not the phone book list) should be prepopulated with the following values already:
First name = Coder
Last name = Byte
Phone = 8885559999"

// code in Angular
`// @ts-ignore
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-area',
template:
<div class="form-wrapper">
<form>
<div>
<label for="firstName">First name</label>
<input type="text" name="firstName" id="firstName" class="userFirstname">
</div>
<div>
<label for="lastName">Last name</label>
<input type="text" name="lastName" id="lastName" class="userLastname">
</div>
<div>
<label for="phoneNumber">Phone number</label>
<input type="tel" name="phoneNumber" id="phoneNumber" class="userPhone">
</div>
<div>
<input type="submit" value="submit" class="submitButton">
</div>
</form>
<div>
<div class="informationTable">
Table of contacts should go here...
</div>
,
styles: []
})

export class MainAppComponent implements OnInit {
// code goes here
ngOnInit() {

}
}`

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more