【发布时间】:2020-03-20 14:26:03
【问题描述】:
这是我的html文件
<html>
<head>
</head>
<body>
<button class="button1" routerLink="/home" title="Home"><span> Back</span></button>
<h3 class="class0">Selected Projects</h3>
<img id="id1" src="../assets/images/cart2.jpg" title="Cart Items">
<div class="div1">
<table>
<tr>
<th>Project Name</th>
<th>Technologies</th>
<th>Description</th>
<th>Sectors</th>
<th>Preview</th>
<th>Delete</th>
</tr>
<tr *ngFor="let data of selectedItem">
<td><span [title]=data.Projectname>{{data.Projectname}}</span></td>
<td><span [title]=data.technologies>{{data.technologies}}</span></td>
<td><span [title]=data.projectdescription>{{data.projectdescription}}</span></td>
<td><span [title]=data.sector>{{data.sector}}</span></td>
<td><button id="button2" mat-button (click)="openDialog(data)"title="Preview"><img src="../assets/images/eye.png"></button>
<td><button id="button2" type="button" title="Delete" (click)="deleteFromCart(data.id)"><img
src="../assets/images/delete2.jpg"></button></td>
</tr>
</table>
</div>
<div class="popup-overlay" *ngIf="currentItem">
<div class="pupup">
<div class="title">Project Preview</div>
<button class="order" (click)="closeDialog()"title="Close">X</button>
<table id=table>
<tr>
<td>Name: </td>
<td id=td>{{currentItem.Projectname}}</td>
</tr>
<tr>
<td>Technologies: </td>
<td id=td>{{currentItem.technologies}}</td>
</tr>
<tr>
<td>Description : </td>
<td id=td>{{currentItem.projectdescription}}</td>
</tr>
<tr>
<td >Sector : </td>
<td id=td>{{currentItem.sector}}</td>
</tr>
</table>
</div>
</div>
<!-- <div class="div2">
<a href="#"><h4>Presentations</h4></a>
<a href="#"><h4>Links</h4></a>
<a href="#"><h4>Videos</h4></a>
</div> -->
</body>
</html>
这是我编写的删除函数
export class Slide10Component implements OnInit {
selectedItem = [];
currentItem: any;
dialog: any;
constructor(private employeService: EmployeeService) { }
ngOnInit() {
this.getdata()
}
deleteFromCart(id){
this.employeService.deleteFromCart(id).subscribe((data:any)=>{
alert("Data deleted succefully");
this.getdata()
})
}
我刚刚发布了 componenet.ts 文件中的部分代码部分。我添加了一个 deleteFromCart() 方法来完成这项工作。 从表中删除项目时,我需要添加淡入淡出效果。 你们能帮帮一个程序员吗?谢谢
【问题讨论】:
-
如果您通过
ng-showhide隐藏数据,那么这是不可能的,因为它遵循display block和none属性,没有动画在其上起作用,为此您需要使用@987654328 之类的属性@ 和visibility:hidden可用于任何类型的动画。