I am new to Angular and I am having trouble making my right-click delete function show the delete button one at a time as opposed to all at once in the right-clicked menu.     This is my array of strings account:string[] = ["one", "two", "three"]; This is where I performed the right-clicked function {{ listitem }} My Right Clicked Function @ViewChild('menu') menu!: ElementRef;rightMenu(e: MouseEvent) { e.preventDefault(); this.menu.nativeElement.style.display = "block"; this.menu.nativeElement.style.top = e.pageY + "px"; this.menu.nativeElement.style.left = e.pageX + "px"; This is where I did delete Delete And this is my delete function delete(index: number) { this.account.splice(index, 1); How do I make my right-click menu show one delete at a time as opposed to showing every delete button in the menu at once?

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

I am new to Angular and I am having trouble making my right-click delete function show the delete button one at a time as opposed to all at once in the right-clicked menu.

 

 

This is my array of strings

account:string[] = ["one", "two", "three"];




This is where I performed the right-clicked function

<div (contextmenu) = "rightMenu($event)" (click) = "disappearContext()"> {{ listitem }} </div>




My Right Clicked Function

@ViewChild('menu') menu!: ElementRef;rightMenu(e: MouseEvent) { e.preventDefault(); this.menu.nativeElement.style.display = "block"; this.menu.nativeElement.style.top = e.pageY + "px"; this.menu.nativeElement.style.left = e.pageX + "px";




This is where I did delete

<div class= "customContext" #menu> <ul> <div *ngFor = "let listitem of account; let myIndex=index;"><li (click) = "delete(myIndex)">Delete</li></div> </ul> </div>



And this is my delete function

delete(index: number) { this.account.splice(index, 1);



How do I make my right-click menu show one delete at a time as opposed to showing every delete button in the menu at once?

Account
one
two
three
Delete
Delete
Delete
Transcribed Image Text:Account one two three Delete Delete Delete
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY