私は初心者で、Angular js の例をいくつか試していますが、2 つの div 要素を作成し、それに対して angular js プログラムを実行しようとしています。ng-repeat を使用している場合、初期化された配列は 2 番目の div で印刷され、最初の div では印刷されません。なぜそれが起こっているのか誰にも教えてもらえますか。2 つの配列が初期化された方法に違いはありません。コードは以下です。
<html data-ng-app>
<head>
<title>Angular js</title>
</head>
<body>
<input type="text" data-ng-model="name">{{name}}
<div class="container" data-ng-init="namess=['Hello','There','God','There']">
<h3>Looping with the ng-repeat Directive</h3>
<h4>Data to loop through is initialized using ng-init</h4>
<ul>
<li data-ng-repeat="Personname in namess">{{Personname}}</li>
</ul>
</div>
<div class="container" data-ng-init="names=['Dave','Napur','Heedy','Shriva']">
<h3>Looping with the ng-repeat Directive</h3>
<h4>Data to loop through is initialized using ng-init</h4>
<ul>
<li data-ng-repeat="name in names">{{name}}</li>
</ul>
</div>
</body>
<footer>
<script type="text/javascript" src="angular.min.js"></script>
</footer>
</html>
私が得ている結果は以下の通りです
Looping with the ng-repeat Directive
Data to loop through is initialized using ng-init
Looping with the ng-repeat Directive
Data to loop through is initialized using ng-init
Dave
Napur
Heedy
Shriva