如果您的Angular 12页面显示渲染问题,则可以尝试以下
import { Component, ChangeDetectorRef } from '@angular/core';
@Component({ selector: 'app-my-component', templateUrl: './my-component.component.html', styleUrls: ['./my-component.component.css'] }) export class MyComponentComponent {
constructor(private cdr: ChangeDetectorRef) { }
ngOnChanges() { this.cdr.detectChanges(); } }
if (environment.production) { enableProdMode(); }
window['enableDebug'] = true; import 'zone.js/dist/zone-error'; // Included with Angular CLI.
trackByFunc(index: number, item: any) { return item.id; }