属性绑定ngForOf
未被嵌入式模板上的任何指令使用。确保属性名称拼写正确,并且所有指令都列在"@NgModule.declarations"
中
<div *ngFor="let post of posts" class="post-preview">
<h1 (click)="goToPost(post)" class="post-title">{{post.title}}</h1>
<p class="post-description">{{post.description}}</p> </div>
在使用bootstrap添加样式之前,一切正常
npm i -s bootstrap
加入bootstrap后;我将imports: [CommonModule, ...],
添加到我的家庭模块中并重新开始工作。在添加bootstrap之前,我刚刚在CommonModule
中导入了app.module.ts