Adr*_*ian 3 components angular
我正在学习Angular 2,我收到一个奇怪的错误:
ERROR in [default] /home/szabo/PhpstormProjects/recipe-book/src/app/recipes/recipe-list/recipe-item.component.ts:11:2当作为表达式调用时,无法解析属性修饰符的签名.提供的参数与呼叫目标的任何签名都不匹配.
这是我的"模特":
recipe.ts
export class Recipe {
constructor(public name, public description, public imagePath) {
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的RecipeItemComponent:
import {Component, OnInit, Input} from '@angular/core';
import { Recipe } from '../recipe';
@Component({
selector: 'app-recipe-item',
templateUrl: './recipe-item.component.html',
styleUrls: ['./recipe-item.component.css']
})
export class RecipeItemComponent implements OnInit {
@Input recipe: Recipe; //line 11
recipeId: number;
constructor() { }
ngOnInit() {
}
}
Run Code Online (Sandbox Code Playgroud)
可能是什么问题呢?谢谢.
Ste*_*ota 13
你的模型不是问题,你()在@Input装饰上缺少:
@Input() recipe: Recipe;
Run Code Online (Sandbox Code Playgroud)
了解更多关于Input 这里.