I'm new to Angular and ng-repeat isnt working for me.
My first ng-repeat works but the second one where im using a json string isn't. Its complaining about ng-repeat dupes but I dont understand why. What I'm I doing wrong?
see the code here JSFiddle
or here:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>test</title>
</head>
<body>
<div ng-app ng-controller="AController">
<ul>
<li ng-repeat="item in firstTest">
{{item}}
</li>
</ul>
<hr />
<ul>
<li ng-repeat="item in secondTest">
{{item}}
</li>
</ul>
</div>
<script src="angular.min.js"></script>
<script type="text/javascript">
function AController($scope) {
$scope.firstTest = {
a: "123",
b: "234"
};
$scope.secondTest = '[{"Price": 123,"ProductName": "apple"},{"Price": 234,"ProductName": "pear"}]';
}
</script>
</body>
</html>