如何从json中检索angularjs表达式的数据

How to retrieve data for angularjs expression from json?

本文关键字:angularjs 表达式 数据 检索 json      更新时间:2023-12-30

我有一个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
})

FACTORY.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/