【发布时间】:2017-05-10 23:43:56
【问题描述】:
在下面的代码中,我尝试在 JSON 输出中搜索特定字符串(例如“name_col_lbl”)并将其值(在本例中为“Name”)返回给 AngularJS 以在视图中输出。
$scope.globalContent = [
{"id":"1","module":"student_reg","item":"name_col_lbl","value":"Name"},
{"id":"2","module":"student_reg","item":"bday_col_lbl","value":"Birthdate"}
]
angular.forEach($scope.globalContent, function(el){
$scope.nameLbl = el ***This is where I need to search for the string and return its value***;
$scope.bdayLbl= el ***This is where I need to search for the string and return its value***;
});
我似乎找不到有效的方法来处理这个问题。提前致谢!
【问题讨论】:
标签: javascript angularjs arrays json