에 객체를 변환 내가 내 HTML 파일에 다음과 같습니다AngularJS와 겨 모델 문자열
<td style="width: 200px;">
<span ng-repeat="list in listGroups">
<label for="{{ list.description }}" />{{ list.description }}</label>
<input ng-model="$parent.listGroup" id="listGroup-{{ list.value }}" name="listGroups" value="{{ list }}" type="radio" />
</span>
</td>
listGroups가 포함
[
{
"description": "New by Territory",
"group": "product",
"type": "new"
},
{
"description": "New by Genre",
"group": "genre",
"type": "new"
},
{
"description": "Charts by Territory",
"group": "product",
"type": "chart"
},
{
"description": "Charts by Genre",
"group": "genre",
"type": "chart"
}
]
나는 NG의 라디오 버튼을 listGroup (설정을 클릭하면 - 모델) 예를 들어,이된다 :
{"description":"New by Genre","group":"genre","type":"new"}
내가 typeof $scope.listGroup
와 listgroup을보고, 나는 그것이 인 것을 알 지금 끈!
이와 같이 나머지 HTML 페이지의 다른 바인딩에있는 속성에 액세스 할 수 없습니다. 이 경우
, 나는 어떻게 객체로 객체를 유지하다, 그것이 내가하고 싶은 일을해야합니까, 더 중요한 것은, 여기에서 일어나고있는 일 이죠 ng-show="listGroup.group == 'genre'"
줄까?
덕분에 모든
데이브
또한 '$ parent.'를 사용하지 마십시오. 그러면 나중에 문제가 발생할 수 있습니다. – bmleite