0
在我的代码有类似如何在AngularJS中隐藏一个组件,但仍然得到一个绑定到它的外部库?
<div ng-if="variableThatEvaluatesToFalse">
<input id="location">
</div>
我试图做的是隐藏组件,然后再显示它在响应用户输入的东西。不过,在我的页面加载时,我希望Google地图可以附加到我的输入中。谷歌地图依赖于document.getElementById('location'),这可能是因为AngularJS'隐藏'它。我可以得到document.getElementById('location')返回我的输入字段,即使它最初由ngIf指令隐藏吗?