无法绑定到“ routerDirection”,因为它不是“ div”的已知属性

时间:2018-12-11 10:21:34

标签: unit-testing ionic3 ionic4

我已经使用Ionic 4创建了Application,并且将routerDirection添加到了div

<div class="finger-print-content" (click)="loginUsingFingerprint()" [routerDirection]="'forward'">
      <img class="fingerprint-btn-img" src="assets/images/fingerprint.png">
      <p class="fingerprint-btn-text" translate>SIGN_IN_USING_FINGERPRINT</p>
    </div>
  </div>

运行ionic serve时一切正常,我在浏览器中提供应用程序,但是当我需要运行单元测试ng test时,我看到了该错误。

Can't bind to 'routerDirection' since it isn't a known property of 'div'

1 个答案:

答案 0 :(得分:1)

我认为语法应为

<div routerLink='/route' routerDirection='forward'>

相同
this.navCtlr.goRoot('/route');