我需要根据json数据动态创建多个控制器。是否可以使用for循环创建? 我喜欢在adf-widget-angular-dashboard中创建动态小部件,每个小部件都有一个控制器。 我的JSON数据如下:
[{
"title": "Testwidget",
"widgetTypes": ["PreVisitorsTrafficPrecGraph", "PreTotalPasserByGraph", "PreTotalVisitorsGraph", "PreNewUsersGraph", "PreReturnUsersGraph"],
"description": "This is Description",
"category": "customWidget",
"controller": "newWidgetTimeSeriesGraphTypeCtrl",
"controllerName": "newWidgetTimeSeriesGraphType",
"templateUrl": "line-bar-chart1",
"graphType": "line",
"graphDetails": "TimeSeries"
},
{
"title": "Testwidget1",
"widgetTypes": ["SessionsPerHour"],
"description": "This is Description1",
"category": "customWidget",
"controller": "newWidgetTimeSeriesGraphTypeCtrl2",
"controllerName": "newTimeSeriesGraphType",
"templateUrl": "line-bar-chart1",
"graphType": "line",
"graphDetails": "HourSeries"
},
{
"title": "Testwidget2",
"widgetTypes": ["PreTotalVisitorsGraph", "PreTotalPasserByGraph"],
"description": "This is Description2",
"category": "customWidget",
"controller": "newWidgetTimeSeriesGraphTypeCtrl",
"controllerName": "newWidgetTimeSeriesGraphType1",
"templateUrl": "line-bar-chart1",
"graphType": "line",
"graphDetails": "CorelationSeries"
},
{
"title": "Testwidget3",
"widgetTypes": ["PreNewUsersGraph", "PreReturnUsersGraph"],
"description": "This is Description3",
"category": "customWidget",
"controller": "newWidgetTimeSeriesGraphTypeCtrl",
"controllerName": "newSeriesGraphType",
"templateUrl": "line-bar-chart1",
"graphType": "line",
"graphDetails": "MultiSeries"
},
{
"title": "Testwidget4",
"widgetTypes": ["PreNewUsersGraph", "PreReturnUsersGraph"],
"description": "This is Description4",
"category": "customWidget",
"controller": "newWidgetTimeSeriesGraphTypeCtrl",
"controllerName": "SeriesGraphType",
"templateUrl": "line-bar-chart1",
"graphType": "line",
"graphDetails": "OthersSeries"
}
]