我一直在研究Angular应用程序,并且一直在跟踪/调整角度的TOH示例,但是这个特定的组件导致我的项目失败。
有没有人看到我不会导致这种失败的事情?
import 'rxjs/add/operator/switchMap';
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, ParamMap } from '@angular/router';
import { Location } from '@angular/common';
import { Purchase } from './purchase';
import { PurchaseService } from './purchases.service';
@Component({
selector: 'purchaseDetails',
templateUrl: './purchase-detail.component.html'
})
export class PurchaseDetailComponent implements OnInit {
purchase: Purchase;
constructor(
private purchaseService: PurchaseService,
private route: ActivatedRoute,
private location: Location
) {}
ngOnInit(): void {
this.route.paramMap
.switchMap((params: ParamMap) => this.purchaseService.getPurchase(+params.get('id')))
.subscribe(purchase => this.purchase = purchase);
}
}
应用程序在我的“正在加载...”文本
的索引页面上挂起答案 0 :(得分:0)
我在组件HTML文件中发现了这个问题。应该检查网页上的错误! :/