Adrian
Adrian

Reputation: 178

Angular 2 error using model in component

I am learning Angular 2 and I am getting a strange error:

ERROR in [default] /home/szabo/PhpstormProjects/recipe-book/src/app/recipes/recipe-list/recipe-item.component.ts:11:2 Unable to resolve signature of property decorator when called as an expression. Supplied parameters do not match any signature of call target.

Here is my "model":

recipe.ts

export class Recipe {
    constructor(public name, public description, public imagePath) {

    }
}

Here is my 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() {
  }

}

What could be the problem? Thanks.

Upvotes: 3

Views: 1975

Answers (1)

Stefan Svrkota
Stefan Svrkota

Reputation: 50643

Your model isn't the problem here, you are missing () on @Input decorator:

@Input() recipe: Recipe;

Read more about Input here.

Upvotes: 13

Related Questions