隐藏angular2模板按钮列表中第一个按钮的简单方法?
Simple way to hide the first button in the list of buttons in angular2 template?
在该部分下,我有一组按钮,我总是需要隐藏 buttons.How 列表中的第一个按钮,我可以这样做吗?
这是我的 html 模板
<section class="list-group results" *ngIf="showSuggestions">
<div class="typeahead-backdrop" (click)="hideSuggestions()"></div>
<button type="button" class="list-group-item"
*ngFor="let result of results; let i = index;"
[class.active]="markIsActive(i, result)"
(click)="handleSelectSuggestion(result)">
<span *ngIf="!taItemTpl"><i class="fa fa-search"></i> {{ result }}</span>
<ng-template
[ngTemplateOutlet]="taItemTpl"
[ngTemplateOutletContext]="{ $implicit: {result: result, index: i} }"
></ng-template>
</button>
</section>
有什么简单的方法可以做到这一点吗?在此先感谢!
你可以只给它添加切片管道,第一个元素不会出现
*ngFor="let result of results | slice:1"
希望对您有所帮助。
在该部分下,我有一组按钮,我总是需要隐藏 buttons.How 列表中的第一个按钮,我可以这样做吗?
这是我的 html 模板
<section class="list-group results" *ngIf="showSuggestions">
<div class="typeahead-backdrop" (click)="hideSuggestions()"></div>
<button type="button" class="list-group-item"
*ngFor="let result of results; let i = index;"
[class.active]="markIsActive(i, result)"
(click)="handleSelectSuggestion(result)">
<span *ngIf="!taItemTpl"><i class="fa fa-search"></i> {{ result }}</span>
<ng-template
[ngTemplateOutlet]="taItemTpl"
[ngTemplateOutletContext]="{ $implicit: {result: result, index: i} }"
></ng-template>
</button>
</section>
有什么简单的方法可以做到这一点吗?在此先感谢!
你可以只给它添加切片管道,第一个元素不会出现
*ngFor="let result of results | slice:1"
希望对您有所帮助。