SAP Spartacus PR 10507第二次尝试

语言: CN / TW / HK
  1. move this.requiredtabindex = -1 into ngAfterViewInit, due to two reasons:

a. before change: In the context of requiresExplicitTabIndex execution, tag does not have href attribute populated yet. For detail see this discussion thread

as a result, we have to put it to ngOnAfterViewInit, at that time the href attribute of a tag is already populated with correct value:

b. The problem here is that we have a situation where the view generation process (which ngAfterViewInit is a part of) is itself further modifying the data that we are trying to display in the first place.

In unit test code it reports error message:

ERROR Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: ‘undefined’. Current value: ‘-1’.

See this blog.

So I use setTimeout() to defer the code to another Javascript Virtual Machine turn.

  1. Since now this.requiredtabindex = -1 is wrapped to setTimeout and executed asynchronously, some unit test will fail:

  1. how to use this extended attribute in units-detail.component.html?

更多Jerry的原创文章,尽在:“汪子熙”:

本文同步分享在 博客“汪子熙”(CSDN)。
如有侵权,请联系 [email protected] 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。

分享到: