angular - 来自html的动态id访问元素

时间:2015-08-18 15:59:31

标签: angularjs dom

http://plnkr.co/edit/BeBKU48YGSJaYPNoaBGF?p=preview



<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div data-ng-app="" ng-init="names=['1','2','3']">
    <div ng-repeat="x in names">
      <button ng-click="getElementById(x).innerHTML=Date()">The time is?</button>

      <p id="{{x}}"></p>
    </div>
</div>
&#13;
&#13;
&#13;

由于某种原因,我无法访问该ID。我做错了什么?

0 个答案:

没有答案