Simple way to hide the first button in the list of buttons in angular2 template?

Ramya S Source

enter image description here

Here under the section, i have set of buttons, i always need to hide the first button in that list of buttons.How can i do that?

This is my html template

 <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>

Is there any simple way to achieve this?Thanks in advance!

angularangular2-template

Answers

answered 6 months ago Kraken #1

you can just add slice pipe to it, and first element won't appear

*ngFor="let result of results | slice:1"

Hope it will help you.

comments powered by Disqus