小编Adr*_*ian的帖子

使用组件中的模型的Angular 2错误

我正在学习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)

可能是什么问题呢?谢谢.

components angular

3
推荐指数
1
解决办法
1760
查看次数

当我指定第一天是星期一时,为什么 moment.weekdays() 返回从星期日开始的天数?

我将语言环境设置为'ro'现在工作日是罗马尼亚语。但是,我也设置了

week : {
    dow : 1
}
Run Code Online (Sandbox Code Playgroud)

moment.weekdays()返回'en'从星期日开始的天数。为什么会这样?

momentjs

3
推荐指数
1
解决办法
7823
查看次数

我可以模拟递归函数中使用的外部函数吗?

以此功能为例:

public static int[] mergeSort(int[] array, int lo, int hi) {
        if (lo == hi) {
            return array;
        }
    int mid = (lo + hi) / 2;
    mergeSort(array, lo, mid);
    mergeSort(array, mid, hi);
    merge(array, lo, mid + 1, hi);

    return array;
}
Run Code Online (Sandbox Code Playgroud)

正如你所看到的那样merge,我想在我的测试中模拟这个函数.有可能的?

java recursion unit-testing

2
推荐指数
1
解决办法
99
查看次数

标签 统计

angular ×1

components ×1

java ×1

momentjs ×1

recursion ×1

unit-testing ×1