角度嵌套的ng-repeat失败

问题描述:

再次是我:)
我仍​​然处于angularJS的最开始,我刚刚遇到了一个有问题的问题。
我有一个数组,其中包含一些我希望在页面上呈现的数据,这就是为什么我使用ng-repeat但我还需要在前一个中包含另一个ng-repeat。
我在dialogWindows中有一般的ng-repeat =对话框,在DOM ng-repeat =dialog.inputs中的输入中有较低的值,但是第二个ngRepeat dousnt工作并且在coonsole中没有报告错误。你可以帮我吗?

it's me again :) I am still at the very beginning with angularJS and I have just encountered a problematic issue. I've got an array with some data that I want to be rendered on the page that's why I use ng-repeat but I also need to include another ng-repeat in the previous one. I have the general ng-repeat="dialog in dialogWindows" and lower in the DOM ng-repeat="input in dialog.inputs", but the second ngRepeat dousnt work and it reports no errors in the coonsole. can You help me please?

这是JS:

 var antroApp = angular.module('antroApp', []);

    function dialogWindows($scope){

    $scope.dialogWindows = [
    {id:0, 
    idName:"pigmentation", 
    number:"1", 
    name:"Pigmentation",
    answer1:"Clear complexion",
    answer2:"Semi-swarthy complexion",
    answer3:"Swarthy complexion",
    answer4:"",
    answer5:"",
    answer6:"",
    inputs:[{id:0,a:"a1",answer:"a"},
            {id:1,a:"a2", answer:"b"}],
    }



    ];

    }
    antroApp.controller('antroApp', antroApp);

这是我的HTML:

<div ng-controller="dialogWindows">
            <div ng-repeat="dialog in dialogWindows">
            <div id="{{dialog.idName}}" class="bold abs">   
                <div class="questionContainer rel">
                    <div class="menu abs">
                        <ul class="menuList">
                            <a href=""><li id="menuStart" class=" unbold">Start</li></a>
                            <a href=""><li id="menuAbout" class=" unbold">About</li></a>
                            <a href=""><li id="menuTech" class=" unbold">Technology</li></a>
                            <a href=""><li id="menuContact" class=" unbold">Contact</li></a>
                        </ul>
                    </div>
                    <div class="questionHeader"><div class="textGradient unbold tgHeaderXY">{{dialog.number}}.{{dialog.name}}</div></div>
                    <div class="empty">&nbsp;</div>
                    <div class="questionBody">

                    <div ng-repat="input in dialog.inputs">
                    <input type="radio" id="radio1" name="sex" value="male">
                    <label for="radio1" class="answer abs {{input.a}}">{{input.answer}}</label>


                    </div>
                    </div>
                    <a href="#hairColor" class="nextButton unbold">Next <i class="icon-arrow-right icon-white"></i></a>

            <i class="icon-pencil tgHeaderIcon icon-3x abs"></i>
            </div><!--/pigmentation-->
            </div><!--/ng-repeat-->
            </div><!--/ng-controller--> 

任何帮助将不胜感激。谢谢

Any help will be appreciated.Thanks

只是一个错误;

在dialog.inputs中设置< div ng-repeat =输入>

set <div ng-repeat="input in dialog.inputs">

而不是< div ng-repat =在dialog.inputs中输入>

作为旁注:

使用< pre> {{input | json}}< / pre> 作为检测问题的基本调试器

use <pre>{{input|json}}</pre> as basic debugger to detect the issue

参见 小提琴