Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/447.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 我正在查找此.myScrollContainer.nativeElement.scrollHeight,但getting无法读取属性';nativeElement';未定义的_Javascript_Angular - Fatal编程技术网

Javascript 我正在查找此.myScrollContainer.nativeElement.scrollHeight,但getting无法读取属性';nativeElement';未定义的

Javascript 我正在查找此.myScrollContainer.nativeElement.scrollHeight,但getting无法读取属性';nativeElement';未定义的,javascript,angular,Javascript,Angular,打开此模板时,我需要从代码this.myScrollContainer.nativeElement.scrollHeight中找到一个divscrollHeight。但我得到的是nativeElement。实际上,div滚动是从上到下的。我需要做的是从下到上滚动。有人知道问题出在哪里吗 {{“workFlowCommentsHistory.commentModalTitle”{翻译} &时代; {{“workFlowCommentsHistory.noCommentMessage”{翻译} {

打开此模板时,我需要从代码
this.myScrollContainer.nativeElement.scrollHeight
中找到一个div
scrollHeight
。但我得到的是
nativeElement
。实际上,div滚动是从上到下的。我需要做的是从下到上滚动。有人知道问题出在哪里吗


{{“workFlowCommentsHistory.commentModalTitle”{翻译}
&时代;
{{“workFlowCommentsHistory.noCommentMessage”{翻译}
{{comments?.creator?.firstName}}|
{{comments.role}}
{{comments?.creator?.createdAt | myDateFormat}}
{{“workFlowCommentsHistory.viewBtn”{翻译}
{{注释?.contents}

{{reply.creator}| {{reply.createdAt | myDateFormat}} {{回复?.contents} {{ “lineComments.viewLineComment.replyCommentValidation” |翻译 }} {{“lineComments.viewLineComment.replyBtn”| translate} {{“prreviewResponseModel.cancel”{翻译}
不是DOM中的物理元素。将其转换为
或在DOM中创建的内容应该可以解决您的问题

例如:

<div #ModalReviewHistory>
  <!-- modal stuff here -->
</div>

您可以通过检查创建的HTML来诊断此问题。您将看到,
不存在。

请(a)仅发布相关代码(但足够完整以重现问题),以及(b)格式化您的代码。
<div #ModalReviewHistory>
  <!-- modal stuff here -->
</div>