Home Angular2-how to remove item in ng-template by ngFor
Reply: 0

Angular2-how to remove item in ng-template by ngFor

user857
1#
user857 Published in July 22, 2018, 10:25 am

I just want to remove item in ngFor,but when I click the remove button,It will always reload the page.I know there is problem in ng-template.Is there any suggestion? Thanks a lot!

here is the code:

<ngb-accordion [closeOthers]="true" #acc="ngbAccordion" class="ngb-accordion" activeIds="ngb0">
     <ngb-panel *ngFor="let stock of StockInvestForecast;let i = index" id="ngb{{i}}">
        <ng-template ngbPanelTitle>
           <span>
              <h4 class="text-purple">{{stock.StockName}}</h4>
              <button type="button" (click)="StockInvestForecast.splice(i,1)" class="btn icon-close-btn">
                <i class="fa fa-close"></i>
              </button>
          </span>
      </ng-template>
</ngb-accordion>
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.313373 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO