Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, I'm working on a page to allow the people to add student name in the textbox and display the name on the table. people

Hello, I'm working on a page to allow the people to add student name in the textbox and display the name on the table. people can add up to 7 names. I store in array and display but the problem is when I click add without put name it creates empty row. If I click twice the add button without putting names, It will create two empty rows. I want if the user doesn't put names, it shouldn't creates empty rows.

NOTE:******Typescript and it not Java Script*******

//This is my code

import { Component, OnInit } from '@angular/core';

@Component({ selector: 'app-names', template: `

Student Names

Student name
{{name}}
`, styles: [] }) export class NamesComponent implements OnInit { studentNames: string[] = []; newName = ''; maxLength = 7;

ngOnInit(): void {

}

addName() { if (this.studentNames.length

image text in transcribed

\begin{tabular}{|l||l||} \hline \hline Student name & \\ \hline \hline \hline \hline & Remove \\ \hline \hline & || Remove \\ \hline \end{tabular}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Eric Redmond ,Jim Wilson

1st Edition

1934356921, 978-1934356920

More Books

Students also viewed these Databases questions

Question

Purpose: What do we seek to achieve with our behaviour?

Answered: 1 week ago