我有一个 json 响应,我想将数据填充到字段中,如何使用 angularjs 表达式来完成该任务。我如何将 json 响应中的值映射到 html 页面。
到目前为止我尝试过这个...
HTML
<div class="row">
<div class="col-md-6">
<label class="control-label">Rule Id</label>
<div>{{ruleIdentifier}}</div>
</div>
<div class="col-md-6">
<label class="control-label">SubpartID</label>
<div>{{subpartId}}</div>
</div>
</div>
MODALCTRL.JS
lrrDetails.findlrrDetail().then(function(response){
$scope.lrrDetail = response;
$scope.ruleidentifier = $scope.lrrDetail.id
})
工厂.JS
findlrrDetail: function(result){
return $http.get('/third-party-management/rest/lrr/17181');
$scope.lrrDetail = result.data;
},
JSON.JS
{"id":1,
"sourceFeedKey":15,
"lookupCode":"RS_DELETED",
"externalIndintifier":"47",
"subpartCitationIndicator":"1",
"ruleIdentifier":"13",
"ruleSubpartExternalIdentifier":"55029",
"subpartCount":null,
"subpartCitationCount":null,
"citationValue":"18 U.S.C. 2711",
"ruleName":"Definitions For Chapter",
"highValueSummary":"This chapter provides guidance on stored wire and electronic communications and transactional records access and contains provisions of the Stored Communications
Act.","
issuingAuthKey":873,
"citationAsOfDate":1325566800000,
"vedourActivityType":"Internal Activity",
"vedourActivityDescription1":null,
"vedourActivityDescription2":null,
"applicabilityIndicator":"0",
"auditGroupCategory":null,
"auditGroupIndicator":null,
"citationCoreIndicator":null,
"createdDate":1352497145890,
"modifiedDate":1375313477250,
"createdBy":"ERDSYSTEM",
"mofifiedBy":"NBKQNXS",
"regulatoryInventoryName"
最佳答案
以下是如何使用 $http
以及如何填充数据的示例。希望它对你有用。
http://jsfiddle.net/8qumcq80/1/
关于javascript - 如何从 json 中检索 angularjs 表达式的数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28588118/