错误无法绑定* ngFor

I'm a beginner in Angular and I'm trying to create an application that looks like CapitalistAdventure. But I have an error that I can't resolve and would like to receive some help please. First of all here is how looks my app: enter image description here

该错误位于app.component.html上,内容为:

无法绑定到“产品”,因为它不是“应用程序产品”的已知属性。 1.如果“ app-product”是Angular组件且具有“ product”输入,则请验证它是否是此模块的一部分。 2.如果“ app-product”是Web组件,则将“ CUSTOM_ELEMENTS_SCHEMA”添加到该组件的“ @ NgModule.schemas”以禁止显示此消息。 3.要允许任何属性,请在此组件的“ @ NgModule.schemas”中添加“ NO_ERRORS_SCHEMA”。

这是我的app.component.html的代码:

  <h1><span id="WorldName">{{world.name}}WORLDNAME</span></h1>
  <!--<span id="WorldImage"><img [attr.src]="server+world.logo"/></span>-->
  <div class="UserData">
    <div class="Money">
      <span id="MoneyName">Money:</span>
      <br>
      <!--<span [innerHTML]="world.money | bigvalue"></span>-->
      <span>$</span>
    </div>
    <div class="Buy">
      <span id="BuyName">Buy</span>
    </div>
    <div class="ID">
      <span id="MoneyName">ID :</span>
    </div>
  </div>
  <div class="Game">
    <div class="UpgradeContainer">
      <div class="Upgrade" (click)="setModal('Unlock')">Unlocks</div>
      <div class="Upgrade" (click)="setModal('Cash')">Cash</div>
      <div class="Upgrade" (click)="setModal('Angels')">Angels</div>
      <div class="Upgrade" (click)="setModal('Managers')">Managers</div>
      <div class="Upgrade" (click)="setModal('Investors')">Investors</div>
    </div>
    <div class="ProductContainer">
      <app-product *ngFor="let product of products" [product]="product"></app-product>
    </div>
</div>

我的app.module.ts:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { RestserviceService } from 'src/app/restservice.service';
import { HttpClientModule } from '@angular/common/http';
import { ProductComponent } from './product/product.component';
import { BigvaluePipe } from './bigvalue.pipe';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import {MatProgressBarModule} from '@angular/material/progress-bar';
@NgModule({
  declarations: [
    AppComponent,
    ProductComponent,
    BigvaluePipe,
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    HttpClientModule,
    BrowserAnimationsModule,
    MatProgressBarModule,
  ],
  providers: [RestserviceService],
  bootstrap: [AppComponent]
})
export class AppModule { }

我的app.component.ts:

 import { Component } from '@angular/core';
import { RestserviceService } from './restservice.service'; 
import { World, Product, Pallier } from './world';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})

export class AppComponent {
  title = 'AngularProject';
  world: World = new World(); 
  server: String;
  products = [1,2,3,4,5,6];
  modal: String;

  constructor(private service: RestserviceService) { 
    this.server = service.getServer(); 
    service.getWorld().then(world => { this.world = world; });   
  }

  setModal(value: String){
    this.modal = value;
  }
}

我的product.component.html:

<div class="Product">
  <div class="ProductInfo">
    <img onclick="alert('Production lancé'), starFabrication() " class="ProductImage" src="./assets/Avatar.jpg">
    <!--<mat-progress-bar mode="determinate" class="ProgressBar" [value]="progressbarvalue"></mat-progress-bar>-->
    <div class="ProductNumber">ProductNumber</div>
    <div class="ProductPrice">ProductPrice</div>
  </div>
</div>

最后是我的product.component.ts:

import { Component, OnInit, Input } from '@angular/core';
import { Product } from 'src/app/world';

@Component({
  selector: 'app-product',
  templateUrl: './product.component.html',
  styleUrls: ['./product.component.css']
})
export class ProductComponent implements OnInit {
  product: Product;
  @Input()
  set prod(value: Product){
    this.product = value;
  }

  constructor() { }

  ngOnInit(): void {
  }

}

我正在开讲,但我在Angular 9。

在此先感谢您抽出宝贵的时间来帮助我。

评论