-3
//appcomponent.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
heroes=[{name:"superman"},{name:"heman"}];
}
//app.component.html
<ul><li *ngfor="let hero of heroes">{{hero.name}}</li></ul>
此代碼不起作用,並給我空白輸出。如果你有解決方案this.pls讓我知道需要ngfor的解決方案
'* ngFor',而不是'* ngfor'? – yurzui
* ngFor not * ngfor – Picci
謝謝picci ... –