未设置Angular2@Input()数组

未设置Angular2@Input()数组,angular,angular2-template,typescript2.0,Angular,Angular2 Template,Typescript2.0,试图将数组传递给@Input()参数,但它根本不显示 <ng-container *ngIf = "searchResults != undefined"> <searchresult *ngFor = "let result of searchResults;" [title] = 'result.title' [authorName] = 'result.authorName' [content] = 'result.conten

试图将数组传递给@Input()参数,但它根本不显示

<ng-container *ngIf = "searchResults != undefined">
   <searchresult *ngFor = "let result of searchResults;" 
      [title] = 'result.title'
      [authorName] = 'result.authorName'
      [content] = 'result.content'
      [tagList] = "result.tagList"
   ></searchresult>
</ng-container>

<p *ngIf = "searchResults == undefined">loading...</p>
这是数组,因此您可以看到标记列表已填充

这就是html输出的内容,因为您可以看到,除了标记列表之外,每个输入属性都已设置


我可能遗漏了什么,如果有什么要告诉我的。提前感谢。

如评论中所述,在将标记列表绑定到
搜索结果组件的
标记列表
输入时,您输入了一个打字错误(
结果.tagList
),而不是
结果.tags


要解决此问题,您必须将绑定更改为
[tagList]=“result.tags”

[tagList]=“result.tagList”
更改为
[tagList]=“result.tags”
@cyr-x我的朋友,您刚刚为我省去了很多麻烦。为此,我感谢你,上帝保佑。贴出你的答案,我将非常乐意接受。
<div class = "search-result">

<div class = 'result-top-section'>
    <div class = 'author-profile'>
         <img width = '70' height = '70' class = 'profile-icon' src= '/images/ogpfp.png'/>
         <p>{{ authorName }}</p>
    </div>
    <div class = 'content'>
        <h2>{{ title }}</h2>
        <p>{{ content }}</p>
    </div>
</div>

<div class = 'result-tag-row'>
        <tag *ngFor = "let tag of tagList;" [tagName] = 'tag'></tag>
</div>
@Component({
 selector: 'searchresult',
 templateUrl: './searchResult.component.html',
 styleUrls: ['./searchResult.component.css']
})

export class SearchResultComponent implements ISearchResult{

 @Input()
 title: string;

 @Input()
 authorName: string;

 @Input()
 content: string;

 @Input()
 tagList: string[];
}