【发布时间】:2018-06-21 17:04:55
【问题描述】:
我目前正在开发一个 Angular Web 项目,该项目是加载 Modal 以更新报告的主要组件类。这个模态报告有标签,其中一个标签是我负责的交易标签。我遇到的问题是,当我关闭更新报告模式并再次打开它时,事务选项卡仍然显示它加载到已初始化组件上的列表。我希望事务选项卡在每次打开更新模式时重新加载数据。这是我加载数据的地方:
enter ngOnInit() {
this.getTransactions();
this.getAllTransmodes();
}code here
这是获取数据的方法:
getTransactions(): void {
this.onDeselect();
this.response = this.reportTransactionsTabService.getTransactions(this.selectedReport.xmlGuid)
.subscribe(
items => {
this.transactions = items;
this.filteredTransactions = this.transactions;
this.totalTransactions = this.filteredTransactions.length
this.filterValue = "";
this.currentSortField = null;
},
error => this.errorMessage = <any>error);
}
【问题讨论】:
-
显示你的模态打开逻辑。此外,您可以在每次触发
(click)处理程序以打开模式时调用ngOnInit中的逻辑(假设它是这样打开的)。 -
我们需要你的全部代码。但是没有它,我只能建议您在模态关闭时执行
this.transactions = undefined(我想它绑定到ngOnDestroy)
标签: angular typescript