我的角度应用程序中有以下 html
\n\n <div class=\'order-list\'>\n <div *ngFor="let order of orders">\n <div class="row ciev-row header-row d-none d-lg-flex bg-white" [ngClass]="{\'last\': i === orders.length - 1}" (click)="toggle(order)">\n <div class="col-sm-3 my-auto">{{order.date}}</div>\n <div class="col-sm-3 my-auto">Livr\xc3\xa9e</div>\n <div class="col-sm-3 my-auto">{{order.order_number}}</div>\n <div class="col-sm-2 my-auto"><span class=\'price\' [innerHTML]=\'order.overallAmount | currencyFormat\'></span></div>\n <div class="col-sm-1 my-auto p-0">\n <i class="fas fa-plus toggle-icon" *ngIf="toggled !== order.functional_id"></i>\n <i class="fas fa-minus toggle-icon" *ngIf="toggled === order.functional_id"></i>\n </div>\n <div class=\'row slider\' [ngClass]="{\'expanded\': toggled === order.functional_id}">\n <div class=\'row ciev-row last extra-data\'>\n <div class=\'col-sm-3 my-auto\'>Produits</div>\n <div class=\'col-sm-3 my-auto\'>Prix HT</div>\n <div class=\'col-sm-3 …Run Code Online (Sandbox Code Playgroud) 我想使用此Angular 6代码实现文件下载:
REST API:
@GetMapping("export")
public ResponseEntity<InputStreamResource> export() throws IOException {
ClassPathResource pdfFile = new ClassPathResource(EXTERNAL_FILE_PATH);
HttpHeaders headers = new HttpHeaders();
headers.add("Cache-Control", "no-cache, no-store, must-revalidate");
headers.add("Pragma", "no-cache");
headers.add("Expires", "0");
return ResponseEntity.ok().headers(headers).contentLength(pdfFile.contentLength())
.contentType(MediaType.parseMediaType("application/pdf"))
.body(new InputStreamResource(pdfFile.getInputStream()));
}
Run Code Online (Sandbox Code Playgroud)
服务:
import {Injectable} from '@angular/core';
import {HttpClient, HttpParams} from "@angular/common/http";
import {Observable} from "rxjs/index";
import {environment} from "../../../environments/environment";
import {HttpUtils} from "../common/http-utils";
import { map } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class DownloadService {
constructor(private http: HttpClient) {
}
downloadPDF(): any {
return …Run Code Online (Sandbox Code Playgroud) 如何pipe在i标签中应用日期日期?下面的代码不起作用:
<i class="fas fa-mouse-pointer font-14 status-icon-active mr-3"
*ngIf="recentDate"
[tooltip]="[recentDate| date: 'medium']"> -- error Here
</i>
Run Code Online (Sandbox Code Playgroud) 我做了一个 spring 反应式后端,它返回 Flux<> 对象。当我使用 angular httpClient调用服务并订阅返回的 observable 时。结果永远不会被触发。那么,如果只有一个响应是可能的,为什么返回 Observable 而不是 Promise 呢?我已经对硬编码的 nodeJS SSE 服务进行了相同的尝试。我有相同的结果,但它适用于事件源。我的问题可能很奇怪,但 Observable 不是偶然选择的,所以我的理解肯定是错误的,我想了解一下。
问题
HTMLElement 类型上不存在属性行错误 TS2339
当在 Angular 7 上循环遍历表格时
我在 Angular 7 上工作,当循环到表 html 并编译时出现错误
src/app/Pages/part-compare/part-compare.component.ts(25,38) 中的错误:
错误 TS2339:类型“HTMLElement”上不存在属性“行”。
src/app/Pages/part-compare/part-compare.component.ts(27,26):错误 TS2339:
类型“HTMLElement”上不存在属性“rows”。
请问这个错误如何解决?
我尝试过的:
var table = document.getElementById("CompareParts");
for (var i = 1, row; row = table.rows[i]; i++) {
for (var j = 0, col; col = row.cells[j]; j++) {
var Cell = table.rows[i].cells
this.ACells.push(Cell);
}
}
this.length=this.ACells.length
for (var x = 0; x < this.ACells.length; x++) {
this.ARows.push(this.ACells[x]);
Run Code Online (Sandbox Code Playgroud) angular7 ×5
angular ×3
typescript ×3
angular6 ×1
html ×1
javascript ×1
ngfor ×1
observable ×1
rxjs ×1