Angular 角度动画值已更改,但不起作用

Angular 角度动画值已更改,但不起作用,angular,angular-animations,Angular,Angular Animations,我有一个关于我使用角度动画的问题,如果我写点击事件,那就是工作。但是我使用google.maps.event单击时发现它不起作用。全球价值也发生了变化。我认为该值已更改,但未影响动画 我的角度版本是5.2.0 maps.component.ts @Component({ selector: 'app-ngx-mw-google-maps', templateUrl: './ngx-mw-google-maps.component.html', styleUrls: ['./ngx-m

我有一个关于我使用角度动画的问题,如果我写点击事件,那就是工作。但是我使用google.maps.event单击时发现它不起作用。全球价值也发生了变化。我认为该值已更改,但未影响动画

我的角度版本是5.2.0

maps.component.ts

@Component({
  selector: 'app-ngx-mw-google-maps',
  templateUrl: './ngx-mw-google-maps.component.html',
  styleUrls: ['./ngx-mw-google-maps.component.sass'],
  encapsulation: ViewEncapsulation.None,
  animations: [
    trigger('sideboxAnimation', [
      state('inactive', style({
        left: '-380px',
      })),
      state('active', style({
        left: '0',
      })),
      transition('* => *', animate('300ms ease-in-out')),
    ]),
  ]
})

export class NgxMwGoogleMapsComponent implements OnInit {
  const that = this;
  sideView = 'inactive';

  ...

  mwInitMaker() {

    ...

    google.maps.event.addListener(marker, "click", function (e) {
      that.clickSideBoxAnimate();
    }
  }

  private clickSideBoxAnimate() {
    if (this.sideView === 'inactive') {
      this.sideView = 'active';
    } else {
      this.sideView = 'inactive';
    }
    console.log(this.sideView);
  }

  animStart(event) {
    console.log(event);
  }

  animEnd(event) {
    console.log(event);
  }
}
maps.component.html

<div class="maps-wrapper">
  <div #map class="map"></div>
  <div class="mw-side" 
  [@sideboxAnimation]='sideView' 
  (@sideboxAnimation.start)="animStart($event)" 
  (@sideboxAnimation.done)="animEnd($event)">
    ...
    <div class="mws-close" (click)="clickSideBoxAnimate()">
      <i class="icon-left-open" *ngIf="sideView == 'active'"></i>
      <i class="icon-right-open" *ngIf="sideView == 'inactive'"></i>
    </div>
  </div>
</div>

...
mws-close
可以播放动画,但谷歌事件不能


最后,我使用detectChanges检查视图及其子视图。这是有效的。

可能是您的
左侧
属性在
上不起作用。因此,尝试用绝对位置(position:absolute)更改
映射包装器
类。仍然没有任何结果。如果我单击
mws-close
animate是工作的,值已更改,但我使用了google事件,虽然值已更改,但animate不工作。我认为问题在于google事件侦听器。我复制
mws close
并构建click事件。在Google事件监听器外部,它可以工作,但在事件内部不工作,但值仍然更改。