我看了其他答案,我想我做對了嗎?但是我仍然得到這個錯誤!數據不是已知的屬性
我的組件看起來是這樣的:
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-autocomplete',
templateUrl: './autocomplete.component.html',
styleUrls: ['./autocomplete.component.css']
})
export class AutocompleteComponent implements OnInit {
@Input() datatype: number;
constructor() { }
ngOnInit() {
}
}
在那裏我稱它看起來像這樣的HTML:
<autocomplete [datatype]="2"></autocomplete>
我已經用角CLI生成一切,所以它是所有的模塊和一切...
您的選擇器是'app-autocomplete'。所以你不能使用'',而是使用''。 –