1

我有一个新闻栏,我使用了 ngx-newsticker,我需要为新闻栏中的每个项目附加一个工具提示。但是,插件需要一个字符串数组,如下所示。

我试图循环抛出数组,但它不起作用:

    <div class="M_announcementDiv" *ngIf="announcementsArrInTicker && announcementsArrInTicker.length>0">
  <div class="container">
    <div placement="bottom" [ngbTooltip]="announcementsArrInTicker">
      <ngx-newsticker title="{{'ANNOUNCEMENTS'|translate}}" [events]="announcementsArrInTicker"  [interval]="interval"></ngx-newsticker>
    </div>
  </div>
</div>

我需要将当前项目推送到此行中的工具提示,而不是推送整个数组。

<div placement="bottom" [ngbTooltip]="announcementsArrInTicker">

这是检索数据的 ts 函数:

getGeneralAnnouncements() {
// this.isAuthenticated = this.authService.isAuthenticated();
this.isAuthenticated =false;

this.newsService.searchGeneralAnnouncements(this.searchModel, this.isAuthenticated).subscribe(res => {
this.announcementArr = res;
  res.announcements.map((announcement) => {
    if(this.translate.currentLang=="ar"){
      this.announcementsArrInTicker.push(announcement.bodyAr);

    }else{
      this.announcementsArrInTicker.push(announcement.bodyEn);

    }
  });
}, error => {
  // this.businessException = errorsUtility.getBusinessException(error);   //this.notificationService.showNotification(this.businessException.message, 
 NotificationType.Error);
})
}
4

0 回答 0