我試圖從一個JSON對象,其中包含表單元素的嵌套組動態構建的一種形式:如何在使用嵌套對象時在AngularJS中製作遞歸模板?
$scope.formData = [
{label:'First Name', type:'text', required:'true'},
{label:'Last Name', type:'text', required:'true'},
{label:'Coffee Preference', type:'dropdown', options: ["HiTest", "Dunkin", "Decaf"]},
{label: 'Address', type:'group', "Fields":[
{label:'Street1', type:'text', required:'true'},
{label:'Street2', type:'text', required:'true'},
{label:'State', type:'dropdown', options: ["California", "New York", "Florida"]}
]},
];
我一直在使用納克開關塊被,但它變得站不住腳嵌套項目,如在上面的地址對象中。
這裏的小提琴: http://jsfiddle.net/hairgamiMaster/dZ4Rg/
如何最好地處理這個問題,嵌套的任何想法?非常感謝!
我只是在一個非常通用的方式回答了這個在上一個不同的問題角文檔:http://stackoverflow.com/questions/ 14430655 /遞歸角度指令/ 29736154#29736154 – tilgovi 2015-04-19 22:02:41