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

时间:2015-02-18 16:05:23

标签: javascript json angularjs

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

1 个答案:

答案 0 :(得分:1)

以下是如何使用$http以及如何填充数据的示例。希望它适合你。 http://jsfiddle.net/8qumcq80/1/