如何更改ngx-bootstrap下拉事件目标图标

时间:2019-04-01 14:26:19

标签: angular ngx-bootstrap

打开下拉菜单时,我需要更改引导图标

我有这样的代码component.html

    <div>
  <span dropdown (isOpenChange)="onOpenChange($event)" class="btn-group">
    <a href id="basic-link" dropdownToggle (click)="false" aria-controls="basic-link-dropdown">
      <img src="./assets/first.svg" *ngIf="!currentLayout && isDropDownOpened">
      <img src="./assets/firts_reg.svg" *ngIf="!currentLayout && !isDropDownOpened">
    </a>
    <ul id="basic-link-dropdown" *dropdownMenu class="dropdown-menu schedule-view" role="menu" aria-labelledby="basic-link">
      <li><a class="dropdown-item" (click)="navigate('')">
        <img src="./assets/first.svg">
        First
      </a></li>
    </ul>
  </span>
</div>

和component.ts

  currentLayout: string;
  isDropDownOpened = false;
  constructor(private router: Router) {}

  ngOnInit() {}

  navigate(layout) {
    this.currentLayout = layout;
    this.router.navigate([`/schedule/${layout}`], { skipLocationChange: true });
  }

  onOpenChange(data: boolean) {
    console.log(data);
    this.isDropDownOpened = !this.isDropDownOpened;

  }

当我单击切换下拉菜单时,控制台中有一次true和一次false,并且没有出现下拉菜单。

0 个答案:

没有答案