Angularjs中的ng-repeat打印3次

时间:2014-05-29 06:19:29

标签: angularjs

index.html
----------

<html ng-app="phoneAPP">
<head>

<title>Insert title here</title>
<script src="http://code.angularjs.org/1.0.7/angular.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js"></script>

<script src="js/angular.js"></script>
</head>
<body ng-controller="phoneListController">
<ul>
<li ng-repeat="phone in phones">

{{phone.name}} : {{phone.snippet}}
</li>
</ul>
</body>
</html>

Controller
-----------
var phoneApp = angular.module('phoneAPP',[]);
phoneApp.controller('phoneListController',function($scope)
{
$scope.phones =[{'name': 'Nexus s',
                 'snippet': 'Fast just got faster with Nexus S.'},
                 {'name':'MOTOROLA',
                  'snippet': 'MOTORALA Brand is good'},
                 {'name': 'NOKIA',
                  'snippet': 'NOKIA Brand has been gone'}];

});

O / P    •Nexus s:使用Nexus S快速加快 •Nexus s:使用Nexus S快速加快 •Nexus s:使用Nexus S快速加快 •MOTOROLA:MOTORALA品牌很好 •MOTOROLA:MOTORALA品牌很好 •MOTOROLA:MOTORALA品牌很好 •诺基亚:诺基亚品牌已经消失 •诺基亚:诺基亚品牌已经消失 •诺基亚:诺基亚品牌已经不见了

如果我只打印一次,为什么要打印3-3次。

0 个答案:

没有答案