简体   繁体   English

在 ng-controller 中查找元素

[英]Find an element inside ng-controller

My Html is like this我的 Html 是这样的

<body ng-controller="MyController" ng-jq>
<div id="printVer"></div>
</div>

and in the head part of the html I have a simple JavaScript snippet like this在 html 的头部,我有一个像这样的简单 JavaScript 片段

document.getElementById("printVer").show();

All looks good to me, but this throws an error对我来说一切都很好,但这会引发错误

Uncaught TypeError: Cannot read property 'show' of null

What am I missing here?我在这里想念什么?

My Html is like this我的 Html 是这样的

<body ng-controller="MyController" ng-jq>
<div id="printVer"></div>
</div>

and in the head part of the html I have a simple JavaScript snippet like this在 html 的头部,我有一个像这样的简单 JavaScript 片段

document.getElementById("printVer").show();

All looks good to me, but this throws an error对我来说一切都很好,但这会引发错误

Uncaught TypeError: Cannot read property 'show' of null

What am I missing here?我在这里想念什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM