我的模式中div中的迭代有问题
<div class="hello"> <div>hi</div> <div>hello</div> <div>bye</div> <div>{{text}}</div> <div>{{heroes[0].name}}</div> <div *ngFor="let hero of heroes"> adsadasdsadsads {{hero.name}} </div> </div>
除了带有ngFor的div之外,其他人都认为可以工作
export class PreviewModalComponent implements OnInit { heroes = []; text: string = "cat"; ngOnInit(): void { // this.headers = ["1", "imie", "nazwisko", "dsadsa"]; this.heroes = [ { id: 1, name: "Superman" }, { id: 2, name: "Batman" }, { id: 5, name: "BatGirl" }, { id: 3, name: "Robin" }, { id: 4, name: "Flash" }, ]; }
此外,DOM中不存在此元素