我有使用休息服务的json响应现在我想使用Angularjs表达式绑定将该数据填充到我的html页面中,我试图在一个字段中获取数据但是我无法呈现。任何帮助将不胜感激。
到目前为止,我已经尝试过这个......
HTML
<div ng-controller="lrrSearchModalCtrl" class="container">
<div class="row">
<label class="control-label">Jurisdiction</label>
<p>-EMEA -United</p>
<p>- Kingdom</p>
</div>
<div class="row">
<div class="col-md-6">
<label class="control-label">Rule Id</label>
<div>{{ ruleIdentifier.id }}</div>
</div>
<div class="col-md-6">
<label class="control-label">SubpartID</label>
<div>{{subpartId}}</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-6">
<label class="control-label">Rule Internal or Outsourced</label>
<div>Rule internal data</div>
</div>
<div class="col-md-6">
<label class="control-label">Subpart Internal or Outsourced</label>
<div>LRR Data one lorem i</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<label class="control-label">Rule Citation</label>
<div>MSRB Gen Rule G-37</div>
</div>
<div class="col-md-6">
<label class="control-label">Subpart Citation</label>
<div>29 CFR 2550.401c-1</div>
</div>
</div>
</div>
searchCtrl.JS
$scope.lrrDetailWinOptions = lrrSearchGridConfig.modalLrrConfig;
$scope.showDetail = function (id){
$scope.selectedId = id;
$scope.lrrDetailWin.open().center();
}
ModalCTRL.JS
angular.module('thirdPartyManagementApp').controller('lrrSearchModalCtrl', function($scope,lrrDetails) {
'use strict';
var result = {
ruleIdentifier:{},
subpartId: {}
}
lrrDetails.findlrrDetail().then(function(response){
console.log(response);
})
$scope.ruleIdentifier = result.ruleIdentifier
$scope.subpartId = getLrrData.subpartId
$scope.showDetail = function(id){
}
});
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":{
"id":2,
"inventoryName":"Electronic Communication",
"erhKey":null,
"regInvetoryclassKey":null,
"ntrntlFlag":true},
"regulatoryInventoryClassfication":{
"id":1,
"classificationName":"Compliance",
"sponserWrokerKey":6411},
"geographicLocations":[
{"id":21598,
"sourceFeedKey":5,
"lookupCode":"RS_ACTIVE",
"externalIndintifier":"1",
"geoLocationTransactionKey":0,
"geoLocationCode":"USA",
"geoLocationName":"United States",
"geoLocationShortName":" ",
"regionIdentifier":1,
"regionName":"United States"}],
"enterpriseReportingHierarchies":[
{"id":161,
"erhTransactionKey":161,
"erhName":"Enterprise Privacy Compliance",
"erhShortName":"LCRR",
"erhLevelNumber":4,
"parentId":3320,
"level0Id":0,
"level0Name":"BAC Enterprise Wide",
"level1Id":804,
"level1Name":"Legal Compliance and Regulatory Relations",
"level2Id":167,
"level2Name":"Global Compliance",
"level3Id":3320,
"level3Name":"Enterprise Compliance",
"level4Id":175,
"level4Name":"Enterprise Privacy Compliance","activeIndicator":"1"}]}
答案 0 :(得分:0)
在您的控制器中,您应该:
lrrDetails.findlrrDetail().then(function(response){
$scope.lrrDetail = response;
})
然后在视图中:
<div class="row">
<div class="col-md-6">
<label class="control-label">Rule Id</label>
<div>{{ lrrDetail.id }}</div>
</div>
<div class="col-md-6">
<label class="control-label">SubpartID</label>
<div>{{lrrDetail.ruleSubpartExternalIdentifier}}</div>
</div>
</div>
显然,使用任何有意义的字段。