在此先感谢您的回复,我正在检查 ddbb 以带上一些项目的名称并将它们绘制在我的 ts 中,如下所示:
应用批处理应用管理.ts
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-batch-app-management',
templateUrl: './batch-app-management.component.html',
styleUrls: ['./batch-app-management.component.scss']
})
constructor(private location: Location,
private activatedRoute: ActivatedRoute,
private deviceService: DeviceService,
private appManagementService: AppManagementService) {
this.deviceNameList = "";
this.mgmtErrorMessage = null;
this.deviceId = "";
this.mgmtErrorMessage = null;
}
ngOnInit() {
this.activatedRoute.queryParams.subscribe(params => {
this.mgmtErrorMessage = null;
this.deviceIdList = params["deviceList"];
this.deviceId = this.deviceIdList[0];
});
for (let i = 0; i < this.deviceIdList.length; i++) {
this.deviceService.getDeviceName(this.deviceIdList[i]).then(deviceName => {
// if (i === 0) {
// this.deviceNameList = deviceName;
// } else {
this.deviceNameList += ", " + deviceName;
// }
}).catch(err => {
this.mgmtErrorMessage = "Oops, could not get the device configuration.";
});
}
}
和我的 app-batch-app-management.html
<div class="h2 mt-16">Application Management of {{deviceNameList}}</div>
我的ts中的上述条件,并不总是绘制所有项目,我认为是因为条件,所以我想删除它,但它首先画了一个逗号,我怎么能删除第一个逗号?