html - 如何有一个角度对话框的输出来告诉父母一些事情
问题描述
这是我选择要编辑的内容并且它处于活动状态时的第一张照片
这是第二张带有已编辑的第二个对象的照片,现在它已被选中,但它是最后一个被选中的。
我有一个 Angular 对话框,我可以传递数据和所有内容,但问题是这样。当我打开带有 id 的选定对象的对话框时,它处于活动状态并且正在工作,但是当我再次打开带有另一个 id 的另一个对象的对话框时,它们都保持活动状态,因此对于每个对象来说,这是任何可能的way to give a command when click cancel or save the dialog will reset the selected object id and when another one is selected only this should be active.
这是我的代码。
<div class="dropdown-menu-item" (click)="openValueItemEditDialog({valueItem: valueItem})">{{'button.#edit'|translate}}</div>
<div [class]="'name-block name-block-width-' + valueItem.level" [ngClass]="{'active': activeSelected === valueItem.id, 'critical': (impactanalyse$ | async) && valueItem.accumulatedImpact === 2 && valueItem.level !== 1, 'semi-critical': (impactanalyse$ | async) && valueItem.accumulatedImpact === 1 && valueItem.level !== 1, 'not-critical': (impactanalyse$ | async) && valueItem.accumulatedImpact === 0 && valueItem.level !== 1, 'selected-critical': (impactanalyse$ | async) && valueItem.level === 1}"
(click)="setAllChildren()">
.name-block {
@extend %common-block;
@include center(false, true);
@include justify-content(space-between);
margin-left: 1px;
padding-left: 10px;
&.active {
z-index: 1950 !important;
}
activeSelected: any = '';
openValueItemEditDialog(editOptions: EditOptions) {
if (editOptions.valueItem) {
this.store.dispatch(new SelectEditedViAction(editOptions.valueItem.id));
}
this.activeSelected = editOptions.valueItem.id;
this.dialog.open(ValueItemEditDialogComponent, { data: editOptions, disableClose: false });
}
这是对话框
<mat-dialog-actions fxLayout="row" fxLayoutGap="10px" fxLayoutAlign="end end" style="margin-right: 37px">
<button *ngIf="!editOptions.planning && editedValueItem.technicalState == 0" (click)="save()" mat-dialog-close>Save</button>
<button mat-dialog-close>Cancel</button>
@Input() activeSelected: boolean
@Output() activeSelectedChange = new EventEmitter<boolean>()
save() {
this.activeSelectedChange.emit(false);
解决方案
推荐阅读
- unit-testing - 为单个接口编写测试并为多个实现运行它们
- python - 未找到 conda 的 R 包
- reactjs - Rescript-react:创建隐藏的画布元素
- java - 线程“主”org.openqa.selenium.WebDriverException 中的异常:返回值无法转换为 WebElement:{stacktrace=Backtrace:
- excel - 从 SQL Server 检索和导出数百万行
- javascript - IIFE 在 javascript 中上课
- active-directory - Samba GPO 策略不适用于 Windows 客户端
- ios - 在 M1 Mac 上运行的 iOS 应用程序的“文件”在哪里?
- mysql - MySQL子查询拉取满足多列数据点的结果
- c++ - 找不到包含文件“字符串”