내 JSON 파일 형식으로되어 있습니다구문 분석 JSON 사용 AngularJS와
{
"doc": {
"BandDatabase": {
"Artist1": {
"-name": "john",
"-instrument": "piano"
"Artist2": [
{
"-name": "tina",
"-instrument": "drums"
"Manager": {
"Person1": {
"-name": "abby"
}
내가 아니라 내 컨트롤러 설정이 있습니다
myApp.controller('MyController', ['$scope', '$http', function ($scope, $http) {
$http.get('js/artists.json').success(function(data) {
$scope.artists = data;
});
을 어떻게 위의 JSON 형식의 요소를 검색 할 수 있습니까? 에 사용 JavaScript
의
<div ng-controller = "MyController">
<ul class="artists">
<li class="messages" ng-repeat="item in artists">
<div class="info">
<h1>{{item.name}}</h1>
</div>
내가 Artist1의 이름과 아티스트 2
, Artist1의 속성이 Artist2입니다 :
은 BTW 당신의
JSON
나는 더 같이한다 상상 ... 나에게 오히려 이상한 보인다? Artist1은 객체이고 Artist2는 배열입니까? – Martin